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

Do not accept POST request from Axios #1082

Closed
vladimirmyshkovski opened this issue Nov 3, 2017 · 1 comment
Closed

Do not accept POST request from Axios #1082

vladimirmyshkovski opened this issue Nov 3, 2017 · 1 comment

Comments

@vladimirmyshkovski
Copy link

vladimirmyshkovski commented Nov 3, 2017

Hello!

If I send post request from httipe like this http http://127.0.0.1:5000/messages text=HelloWorld, all is well, and i get this server answers:

127.0.0.1 - - [03/Nov/2017 22:41:13] "OPTIONS /messages HTTP/1.1" 200 -
127.0.0.1 - - [03/Nov/2017 22:52:45] "POST /messages HTTP/1.1" 201 -

But, if I try send POST from axios, like this:

      axios.post(`http://127.0.0.1:5000/messages`, {
        text: JSON.stringify(data)
      })
        .then(response => {
          console.log(response)
        })
        .catch(e => {
          console.log(e)
        })

server return just OPTIONS:

127.0.0.1 - - [03/Nov/2017 22:41:13] "OPTIONS /messages HTTP/1.1" 200 -

POST does not reach the request. I do not understand what's the matter.

My settings:

RESOURCE_METHODS = ['GET', 'POST', 'DELETE']
PUBLIC_METHODS = ['GET', 'POST']
ITEM_METHODS = ['GET', 'PATCH', 'PUT', 'DELETE']
PUBLIC_ITEM_METHODS = ['GET', 'PATCH', 'PUT']

X_DOMAINS_RE = '*'

X_DOMAINS = '*'
@nicolaiarocci
Copy link
Member

This looks like a client issue. Please use StackOverflow for this kind of inquiries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants