Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Method override support for POST, PUT, Delete Methods #151

Open
raviroshan opened this issue Mar 12, 2017 · 1 comment
Open

Method override support for POST, PUT, Delete Methods #151

raviroshan opened this issue Mar 12, 2017 · 1 comment

Comments

@raviroshan
Copy link

@raviroshan raviroshan commented Mar 12, 2017

Expected behavior

Flexibility to override the HTTP methods as the API may not support the user requested methods.

Actual behavior

Not able to override HTTP methods.

Setup

  • server: webpac-dev-server

I am using webpack-dev-server as a proxy to my original API URL to avoid CORS related issues and dynamically pointing to Dev, UAT, Mock server URL based on the environments.

For Mock dev - I prefer to use the JSON from the local file system and it servers its purpose for all the GET request.

One possible approach may be - Overriding the HTTP Request methods to GET as I am not passing any payload. But I can't find any configuration for that.

http://stackoverflow.com/questions/42735457/webpack-dev-server-support-for-post-put-delete-methods-using-proxy

@tavelli

This comment has been minimized.

Copy link

@tavelli tavelli commented Mar 1, 2018

making use of onProxyReq event worked for me

onProxyReq: function(proxyReq, req, res) {
    // convert all api requests (POST/PUT/DELETE) to GET so they work in webpack dev server for mocking
    proxyReq.method =  'GET';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.