mirror of
https://github.com/nushell/nushell.git
synced 2024-11-22 16:33:37 +01:00
Avoid duplicating post headers (#5200)
* Avoid duplicating post headers This should fix #5194 * Update post.rs Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com>
This commit is contained in:
parent
6a1378c1bb
commit
8e2847431e
@ -205,6 +205,13 @@ fn helper(
|
||||
};
|
||||
|
||||
let mut request = http_client(args.insecure.is_some()).post(location);
|
||||
|
||||
// set the content-type header before using e.g., request.json
|
||||
// because that will avoid duplicating the header value
|
||||
if let Some(val) = args.content_type {
|
||||
request = request.header("Content-Type", val);
|
||||
}
|
||||
|
||||
match body {
|
||||
Value::Binary { val, .. } => {
|
||||
request = request.body(val);
|
||||
@ -235,9 +242,6 @@ fn helper(
|
||||
}
|
||||
};
|
||||
|
||||
if let Some(val) = args.content_type {
|
||||
request = request.header("Content-Type", val);
|
||||
}
|
||||
if let Some(val) = args.content_length {
|
||||
request = request.header("Content-Length", val);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user