-
Notifications
You must be signed in to change notification settings - Fork 352
Open
Labels
addition/proposalNew features or enhancementsNew features or enhancementsneeds implementer interestMoving the issue forward requires implementers to express interestMoving the issue forward requires implementers to express interesttopic: api
Description
What problem are you trying to solve?
Currently, we have a Response.json(obj, init)
static method to build JSON Response
, cf #1389
However, we do not seem to have a Request.json(url, obj, init)
equivalent to build JSON Request
.
What solutions exist today?
Setting body
with JSON.stringify
as well as the content-type
header by hand :
new Request(url, {
body: JSON.stringify(obj),
headers: {
"content-type": "application/json"
}
});
How would you solve it?
I suggest adding a Request.json(url, obj, init)
static method mirroring the Response.json(obj, init)
static method.
Alternatively, it could be a Request.json(url, init)
static method (the JS object then being given through init.body).
Anything else?
No response
EskiMojo14, gustavopch, svr93 and Delapouite
Metadata
Metadata
Assignees
Labels
addition/proposalNew features or enhancementsNew features or enhancementsneeds implementer interestMoving the issue forward requires implementers to express interestMoving the issue forward requires implementers to express interesttopic: api