fix(client): return error if Request has CONNECT method
The higher-level `Client` has never supported `CONNECT` requests, but it used to send them, and then handle the responses incorrectly. Now, it will return an error immediately instead of misbehaving.
This commit is contained in:
@@ -592,6 +592,32 @@ test! {
|
||||
|
||||
}
|
||||
|
||||
test! {
|
||||
name: client_connect_method,
|
||||
|
||||
server:
|
||||
expected: "\
|
||||
CONNECT {addr} HTTP/1.1\r\n\
|
||||
Host: {addr}\r\n\
|
||||
\r\n\
|
||||
",
|
||||
// won't ever get to reply
|
||||
reply: "",
|
||||
|
||||
client:
|
||||
request:
|
||||
method: Connect,
|
||||
url: "http://{addr}/",
|
||||
headers: [],
|
||||
body: None,
|
||||
proxy: false,
|
||||
error: |err| match err {
|
||||
&hyper::Error::Method => true,
|
||||
_ => false,
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
test! {
|
||||
name: client_set_host_false,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user