Changeset 49133
- Timestamp:
- 10/12/2020 08:09:14 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/js/_enqueues/wp/api-request.js
r47122 r49133 10 10 * 11 11 * @since 4.9.0 12 * @since 5.6.0 Added overriding of the "PUT" and "DELETE" methods with "POST". 12 13 * @output wp-includes/js/api-request.js 13 14 */ … … 24 25 var url = options.url; 25 26 var path = options.path; 27 var method = options.method; 26 28 var namespaceTrimmed, endpointTrimmed, apiRoot; 27 29 var headers, addNonceHeader, headerName; … … 77 79 } 78 80 81 if ( typeof method === 'string' ) { 82 method = method.toUpperCase(); 83 84 if ( 'PUT' === method || 'DELETE' === method ) { 85 headers = $.extend( { 86 'X-HTTP-Method-Override': method 87 }, headers ); 88 89 method = 'POST'; 90 } 91 } 92 79 93 // Do not mutate the original options object. 80 94 options = $.extend( {}, options, { 81 95 headers: headers, 82 url: url 96 url: url, 97 method: method 83 98 } ); 84 99
Note: See TracChangeset
for help on using the changeset viewer.