I tried to make a Http POST request using json as a payload but I can't make it work.
To do that, I need to add a "Content-Type: application/json" header. So I used Http.Request:
This does some weird stuff : it sends not a POST request anymore but an OPTIONS one.
What’s weirder is that if I use the exact same command without the headers (thus with an empty list), it sends a correct POST request.
I tried adding a ":" at the end of the header key but then I get :
"Failed to execute 'setRequestHeader' on 'XMLHttpRequest': 'Content-Type:' is not a valid HTTP header field name."
With curl I would do like this (in fact, I tested it and it works):
@request is a file containing the json object to send.
Does anybody have an idea what’s going on ?