-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support NO_PROXY environment variable
- Loading branch information
1 parent
73f3779
commit a49c7ae
Showing
8 changed files
with
143 additions
and
5 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright (c) 2024 - Restate Software, Inc., Restate GmbH. | ||
// All rights reserved. | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the LICENSE file. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0. | ||
|
||
use http::uri::Authority; | ||
use serde::Deserialize; | ||
use serde_with::{DeserializeAs, SerializeAs}; | ||
|
||
/// SerializeAs/DeserializeAs to implement ser/de trait for [Authority] | ||
/// Use it with `#[serde(with = "serde_with::As::<AuthoritySerde>")]`. | ||
pub struct AuthoritySerde; | ||
|
||
impl SerializeAs<Authority> for AuthoritySerde { | ||
fn serialize_as<S>(source: &Authority, serializer: S) -> Result<S::Ok, S::Error> | ||
where | ||
S: serde::Serializer, | ||
{ | ||
serializer.serialize_str(source.as_str()) | ||
} | ||
} | ||
|
||
impl<'de> DeserializeAs<'de, Authority> for AuthoritySerde { | ||
fn deserialize_as<D>(deserializer: D) -> Result<Authority, D::Error> | ||
where | ||
D: serde::Deserializer<'de>, | ||
{ | ||
let buf = String::deserialize(deserializer)?; | ||
Authority::try_from(buf).map_err(serde::de::Error::custom) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters