Multipart Method Overriding
HTTP method overriding is a technique used to support clients or intermediate proxies that do not support certain HTTP methods, such as PUT, PATCH, or DELETE. By using a POST request with an override signal, you can communicate your intended HTTP method.
Override via Request Headers
Include the X-HTTP-Method-Override header in your POST request to specify the target method.
js
axios({
method: "POST",
headers: {
"X-HTTP-Method-Override": "PATCH"
},
data: formData
});| Parameter | Description |
|---|---|
X-HTTP-Method-Override | The intended HTTP method (e.g., PUT, PATCH, DELETE). |
Override via Query Parameters
Pass the target method using the _method query parameter. This is useful if your client environment makes it difficult to manipulate request headers.
js
axios({
method: "POST",
url: "http://localhost/api/example",
params: {
_method: "PATCH"
},
data: formData
});| Parameter | Description |
|---|---|
_method | The intended HTTP method (e.g., PUT, PATCH, DELETE). |