Skip to content

Commit 408f9bc

Browse files
committed
Redefine Method, StatusCode from http_types in typespec
Resolves Azure#1644 and replaces Azure#2233. The latter PR was a good attempt but we decided internally we don't want to take a dependency on a different crate - `http` ; though, we do have a transitive dependency on it already - for something so simple. This starts as a copy from http_types with appropriate attribution. We may want to remove a bunch of Methods we don't need, though, at some point.
1 parent 71134c6 commit 408f9bc

File tree

14 files changed

+1476
-422
lines changed

14 files changed

+1476
-422
lines changed

Diff for: Cargo.lock

+28-183
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ flate2 = "1.1.0"
8989
futures = "0.3"
9090
getrandom = { version = "0.2", features = ["js"] }
9191
hmac = { version = "0.12" }
92-
http-types = { version = "2.12", default-features = false }
9392
litemap = "0.7.4"
9493
log = "0.4"
9594
oauth2 = { version = "5.0.0", default-features = false }

Diff for: NOTICE.txt

+28
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,31 @@ In the event that we accidentally failed to list a required notice, please
2727
bring it to our attention. Post an issue.
2828

2929
The attached notices are provided for information only.
30+
31+
License notice for `http_types::{Method, StatusCode}`
32+
------------------------------------------------------------------------------
33+
34+
The MIT License (MIT)
35+
36+
Copyright (c) 2019 Yoshua Wuyts
37+
Copyright (c) 2017 http-rs authors
38+
Copyright (c) 2020 Jacob Brown
39+
Copyright (c) 2016-2018 Michael Tilli (Pyfisch) & `httpdate` contributors
40+
41+
Permission is hereby granted, free of charge, to any person obtaining a copy
42+
of this software and associated documentation files (the "Software"), to deal
43+
in the Software without restriction, including without limitation the rights
44+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
45+
copies of the Software, and to permit persons to whom the Software is
46+
furnished to do so, subject to the following conditions:
47+
48+
The above copyright notice and this permission notice shall be included in all
49+
copies or substantial portions of the Software.
50+
51+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
52+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
53+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
54+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
55+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
56+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
57+
SOFTWARE.

Diff for: sdk/typespec/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ keywords = ["typespec"]
1313

1414
[dependencies]
1515
base64.workspace = true
16-
http-types = { workspace = true, optional = true }
16+
serde = { workspace = true, optional = true }
1717
serde_json = { workspace = true, optional = true }
1818
url.workspace = true
1919

@@ -22,6 +22,6 @@ thiserror.workspace = true
2222

2323
[features]
2424
default = ["http", "json"]
25-
http = ["dep:http-types"]
26-
json = ["dep:serde_json"]
25+
http = []
26+
json = ["dep:serde", "dep:serde_json"]
2727
amqp = []

Diff for: sdk/typespec/src/error/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
//! Interfaces for working with errors.
55
66
#[cfg(feature = "http")]
7-
use http_types::StatusCode;
8-
7+
use crate::http::StatusCode;
98
use std::borrow::Cow;
109
use std::fmt::{Debug, Display};
1110

Diff for: sdk/typespec/src/http/mod.rs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
mod status_code;
5+
6+
pub use status_code::StatusCode;

0 commit comments

Comments
 (0)