[Webkit-unassigned] [Bug 212858] Request object's text, json, arrayBuffer function do not work even though devtools shows that request the request object has these properties.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jun 5 19:14:20 PDT 2020


https://bugs.webkit.org/show_bug.cgi?id=212858

--- Comment #2 from Peter W <peter.b.wu at oracle.com> ---
When creating a new POST request within the Safari console using the following example,

var request = new Request('/', {
  method: 'POST',
  body: '{ "foo": "1", "bar": 2 }' 
});

request.json().then(function(json) { 
  console.log(json.foo);
  console.log(json.bar);
});


However in my application when i try to access the request.text(), theres an error that states "NotSupportedError: The operation is not supported" and I'm not sure whats causing this to occur.

function sendRequest(input,requestInit){
    // create request object for POST request
    var request = new Request(input.url, requestInit);
    // trying to read the clone body will throw the above error
    Var requestclone = request.clone().text().then(text=>console.log(text)).catch(err=>console.log(err));

    fetch(request).then(response=>{
        //do stuff here
    });

When running the same function with a GET or a PUT request, the .text() functions works and I run into no issues. The not supported Error only occurs on a POST request.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20200606/8b85956d/attachment.htm>


More information about the webkit-unassigned mailing list