Bug 182476 - HTTP POST not sending body in IOS<11
Summary: HTTP POST not sending body in IOS<11
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: XML (show other bugs)
Version: Safari 9
Hardware: Unspecified Unspecified
: P1 Blocker
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-02-05 01:46 PST by Shubham Chawla
Modified: 2018-02-06 11:28 PST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Shubham Chawla 2018-02-05 01:46:24 PST
HTTP Post is not sending body for iOS version <11 in WKWebView. 

Sample request is 

            fireXhr("https://hooks.zapier.com/hooks/catch/XXX/", {
               loginId: 4,
               password: 4
              }, "POST", 
                    {},
                    function(response) {
                  console.log(response);
              });
          }
         
          function fireXhr(url, data, method, headers, callback) {
            try {
              var request = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
              callback && (request.onreadystatechange = function() {
                if(request.readyState == 4 && request.status == 200) {
                  callback(request);
                }
              });
              request.open(method, url, true);
              for(var header in headers) {
                request.setRequestHeader(header, headers[header]);
              }
              request.send(JSON.stringify(data));
            }
            catch(e) {
              console.log(e);
            }
          }
Comment 1 Alexey Proskuryakov 2018-02-06 11:28:44 PST
If this works correctly in currently shipping version, then there is nothing to fix from WebKit side. We can not change the past.