|
|
|
|
|
by Sophira
37 days ago
|
|
> ...there are ways to produce request bodies that are valid JSON even if the browser forces you into a different format... The browser basically never forces you into a particular format. You don't even need to do the trick with the form stuff that the sibling was talking about. Consider the following JavaScript: var xhr = new XMLHttpRequest();
var url = "http://localhost:12345/endpoint";
xhr.open("POST", url, true);
xhr.setRequestHeader('Content-Type', 'multipart/form-data');
xhr.send('{"hello":"world"}');
No trickery required, it just does it.[Edited to illustrate my point better.] |
|