axios patch code example
Example 1: AXIOS CDN
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
Example 2: axios post with header
// Send a POST request
axios({
method: 'post',
url: '/user/12345',
data: {
firstName: 'Fred',
lastName: 'Flintstone'
},
headers: {'Authorization': 'Bearer ...'}
});
Example 3: axios post
axios.post('/user', {
firstName: 'Fred',
lastName: 'Flintstone'
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
Example 4: axios library
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
Example 5: axios put
const res = await axios.put('https://httpbin.org/put', { hello: 'world' });
res.data.headers['Content-Type']; // application/json;charset=utf-8
Example 6: axios put request
const res = await axios.put('https://httpbin.org/put', { hello: 'world' });
res.data.headers['Content-Type'];