-
|
I'm trying to rewrite some code from the native HttpClient to this builder. The code using Content-Type header on the body of the GET request (it was actually supposed to be in the request header, but at some moment I found that it was impossible to set Content-Type header on the GET request itself in the .NET so I had to make en empty string content for the request and attach the header to it). Here is the snippet that originally worked for me: and this fails at compile time with the error: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Hi @konst-sh, some month ago you wrote; here's my reply :)
http {
GET "url"
Accept "application/vnd.onshape.v2+json;charset=UTF-8;qs=0.2"
header "OnNonce" "nonce"
AuthorizationBearer "token"
Date DateTime.Now
body
ContentType "application/json"
}
|> Request.send |
Beta Was this translation helpful? Give feedback.
Hi @konst-sh,
some month ago you wrote; here's my reply :)
ContentTypeis a heady related to the body, so it has to be defined in thebodysection of the request. Better: you use one of the available custom operations likejsonorjsonSerialize, which sets the content type automatically.