woocommerce / woocommerce-rest-api-js-lib

New JavaScript library for WooCommerce REST API
https://www.npmjs.com/package/@woocommerce/woocommerce-rest-api
MIT License
282 stars 75 forks source link

Various requests return different errors #103

Closed anoblet closed 3 years ago

anoblet commented 3 years ago

Using this library the only thing that seems to be working is GET requests.

PUT requests return 200, though no data is modified. POST requests with no data return 200. POST requests with data return 401 unauthorized. DELETE requests return 501 not implemented.

Using Postman, all of these requests work.

Any suggestions/advice would be much appreciated.

anoblet commented 3 years ago

Solved:

Do not use:

axiosConfig: {
    headers: {}
}

to get rid of the Refused to set unsafe header "User-Agent" warning. This will cause PUT/POST to not work.

For DELETE requests, if the item is unable to be moved to the trash, the API will respond with 501 not implemented