mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-19 09:05:22 +01:00
ba5b09af09
This allows for making REST API calls with the PUT and DELETE HTTP methods that may be blocked or unsupported by some server configurations. Props yakimun. Fixes #43605. Built from https://develop.svn.wordpress.org/trunk@49133 git-svn-id: http://core.svn.wordpress.org/trunk@48895 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2 lines
944 B
JavaScript
2 lines
944 B
JavaScript
/*! This file is auto-generated */
|
|
!function(w){var c=window.wpApiSettings;function n(e){return e=n.buildAjaxOptions(e),n.transport(e)}n.buildAjaxOptions=function(e){var n,t,o,r,p,a,i=e.url,d=e.path,s=e.method;if("string"==typeof e.namespace&&"string"==typeof e.endpoint&&(n=e.namespace.replace(/^\/|\/$/g,""),d=(t=e.endpoint.replace(/^\//,""))?n+"/"+t:n),"string"==typeof d&&(o=c.root,d=d.replace(/^\//,""),"string"==typeof o&&-1!==o.indexOf("?")&&(d=d.replace("?","&")),i=o+d),p=!(e.data&&e.data._wpnonce),r=e.headers||{},p)for(a in r)if(r.hasOwnProperty(a)&&"x-wp-nonce"===a.toLowerCase()){p=!1;break}return p&&(r=w.extend({"X-WP-Nonce":c.nonce},r)),"string"==typeof s&&("PUT"!==(s=s.toUpperCase())&&"DELETE"!==s||(r=w.extend({"X-HTTP-Method-Override":s},r),s="POST")),delete(e=w.extend({},e,{headers:r,url:i,method:s})).path,delete e.namespace,delete e.endpoint,e},n.transport=w.ajax,window.wp=window.wp||{},window.wp.apiRequest=n}(jQuery); |