8
$\begingroup$

Bug introduced in V11.0 and persisting through 11.3

[CASE:3981157] confirmed


asso = <|
  "Scheme" -> "http"
, "Domain" -> "www.wolframalpha.com/"
, "ContentType" -> "application/json"
|>;

This is a valid and documented syntax:

HTTPRequest @ asso //InputForm
HTTPRequest[
  <|"Scheme" -> "http", "Domain" -> "www.wolframalpha.com/"|>
, <|"ContentType" -> "application/json"|>
]

but it breaks when one provides options:

HTTPRequest[asso, CharacterEncoding -> Automatic] // InputForm
HTTPRequest[
  <|"Scheme" -> "http", "Domain" -> "www.wolframalpha.com/", "ContentType" -> "application/json"|>
, <||>
, CharacterEncoding -> Automatic
]

So it was not split correctly on url and metadata part. Which will result in malformed request.

Have I missed something?

$\endgroup$
3
$\begingroup$

So before it is fixed one needs to arrange full input with help of e.g. URLBuild:

HTTPRequest[
  URLBuild@asso, asso, CharacterEncoding -> Automatic
] // InputForm
HTTPRequest[
  "http://www.wolframalpha.com//"
, <|..., "ContentType" -> "application/json"|>
, CharacterEncoding -> Automatic
]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.