Can't set headers on my WKWebView POST request

前端 未结 7 1380
花落未央
花落未央 2020-12-04 12:50

I want to do a POST request to my WKWebView but the headers doesn\'t get set when I monitor the requests with Charles so the request fails. What is wrong here?<

7条回答
  •  旧时难觅i
    2020-12-04 13:30

    I can confirm this problem. A simple workaround for me was an AJAX request, with jQuery:

    $.ajax({
        type : 'POST',
        url : $('#checkout-form').attr('action'),
        data : $('#checkout-form').serialize()
    }).done(function(response, status) {
        // response if return value 200
    }).fail(function(status, error) {
        console.log(error);
    });
    

    where my form looks like

    ...

    I hope this helps somebody...

提交回复
热议问题