We are developing an API with Coldox, and UI with vueJS and are experiencing really odd behaviour with POST and PUT requests from vueJS to coldbox.
We can run a GET without issue. However POST and PUT requests are receiving response: InvalidHTTPMethod Execution of (onInvalidHTTPMethod)
Note that if we submit the PUT or POST requests it works fine. And if we change the endpoint in vueJS to another API the PUT and POST requests work fine. It only seems to be from vueJS to the Coldbox API that the PUT and POST requests are receiving InvalidHTTPMethod error. So there is something amiss between vueJS and Coldbox?
As far as we can tell everything is setup correct in Coldbox. Has anyone had similar issues?
Thank you for any suggestions!
COLDBOX ROUTE
`
addRoute(
pattern = 'tasks/:taskID?',
handler = 'tasks',
action = {
POST = 'save',
PUT = 'save',
GET = 'read'
});
`
Handler (tasks.cfc)
`
component extends="BaseHandler"{
this.allowedMethods = {save='POST,PUT',read='GET'};
/**
* put
*/
function save( event, rc, prc ) {
event.renderData('json',{"blah":"blah"});
}
/**
* get
*/
function read( event, rc, prc ){
event.renderData('json',rc);
}
}
`
vueJS request
`
this.$http.put('tasks/1', {"status":"complete"})
.then(response => {
console.log(response);
})
`