asp.net mvc - Does NOT support http GET when sending POST -
tried looking around web bit , @ loss. setting rest api.
locally using postman send post end point , well. once pushed test server , run post
status: 405 method not allowed { "message": "the requested resource not support http method 'get'." }
controller looks , said, able post locally not test server
[httppost, route("")] [responsetype(typeof(string))] public async task<ihttpactionresult> createsomething([frombody] obj stuff)
c# generated post man
var client = new restclient("http://test-api.someurl.com/makestuff/makethisthing/"); var request = new restrequest(method.post); request.addheader("postman-token", "not sure if needed post man put here"); request.addheader("cache-control", "no-cache"); request.addheader("authorization", "bearer [a long oauth token]"); request.addheader("content-type", "application/json"); irestresponse response = client.execute(request);
it works fine locally running on local iis (not iis express) on pc , other dev pc. once put test server error message. know using post using postman {{server}} env var , changing local test env post not chaining @ all
there handful of other end points in separate web applications working fine.
any point in right direction, thank you
since you're sure you're requesting via post, error unambiguously says you're attempting get, thing makes sense there's redirect occurring. redirect return 301 or 302 location header. client requests new url there via get, if original request post. in other words, flow like: post -> 302 -> -> 405.
Comments
Post a Comment