| title | put( url, [body], [args] ) - Mock HTTP PUT Requests with Mokapi JavaScript API |
|---|---|
| description | Use Mokapi's JavaScript API to mock HTTP PUT requests. Customize responses, handle request data, and simulate APIs for testing and development. |
Make a PUT request
| Parameter | Type | Description |
|---|---|---|
| url | string | Request URL like https://foo.bar |
| body | any | Request body, objects will be encoded as application/json |
| args (optional) | object | Args object containing additional request parameters |
| Type | Description |
|---|---|
| Response | Response object |
import { put } from 'mokapi/http'
export default function() {
const res = put('https://foo.bar/foo', { 'foo': 'bar' }, {
headers: { 'Content-Type': 'application/json' }
})
console.log(res.json())
}