Firefox 用户 13847856 的评价
评分 3 / 5
来自 Firefox 用户 13847856,7 年前Nice, but does not send GET request with body.
site/elements/data/scripts/request.js:
if (request.method.toLowerCase() !== 'head' && request.method.toLowerCase() !== 'get') {
init.body = requestBody;
}
Update:
I don't have much experieces with node.js, but...
Maybe it can be achieved with socket.io and emulate http protocol?
I wanted to use your extension for doing requests to elasticsearch, it uses GET and in http body is json.
site/elements/data/scripts/request.js:
if (request.method.toLowerCase() !== 'head' && request.method.toLowerCase() !== 'get') {
init.body = requestBody;
}
Update:
I don't have much experieces with node.js, but...
Maybe it can be achieved with socket.io and emulate http protocol?
I wanted to use your extension for doing requests to elasticsearch, it uses GET and in http body is json.
开发者回应
发布于 7 年前Hi, thanks for taking the time to dig into this issue. Unfortunately it is by design and there is no way to fix it (that I know of).
RESTer is a browser extension and the browser provides two ways of sending HTTP requests:
1. XMLHttpRequest: This ignores any specified body and sets it to null when the method is GET or HEAD.
2. fetch: This throws a TypeError when you specifiy a body and the method is GET or HEAD.
Browsers have good reason to do so. While, according to the HTTP/1.1 spec, you are allowed to send a request body with a GET or HEAD request, the server is advised to ignore the body when handling the request. See here for a good explanation:
https://stackoverflow.com/a/983458/1798215
That said, if you have ideas on how to handle this better, please let me know. I am definitely open to suggestions. Post them on GitHub or send me an email:
https://github.com/frigus02/RESTer/issues
RESTer is a browser extension and the browser provides two ways of sending HTTP requests:
1. XMLHttpRequest: This ignores any specified body and sets it to null when the method is GET or HEAD.
2. fetch: This throws a TypeError when you specifiy a body and the method is GET or HEAD.
Browsers have good reason to do so. While, according to the HTTP/1.1 spec, you are allowed to send a request body with a GET or HEAD request, the server is advised to ignore the body when handling the request. See here for a good explanation:
https://stackoverflow.com/a/983458/1798215
That said, if you have ideas on how to handle this better, please let me know. I am definitely open to suggestions. Post them on GitHub or send me an email:
https://github.com/frigus02/RESTer/issues