SOLVED - Meteor.HTTP Client Sided POST produces OPTIONS Call


#1

Something really strange happens.

When I do a

Meteor.http.call("post", "http://my.server.de/route", {
   data: {
      hallo: 1,
      du:2
   }
}, function success(ret, dat) {
   console.log(ret, dat)
});

I get a strange call with the Method OPTIONS instead of the POST that it should produce.


#2

I would suggest providing more information to make it easier for people to help you. What does “strange call” mean, exactly?


#3

My Window manager just crashed…

here some more information.

when I do the Meteor.http.call("post"...) it does not do a POST but and OPTIONS call first. As my REST API has no implemented OPTIONS call, it of course crashes…


#4

This is standard HTTP, and every browser does this. Read up on OPTIONS: http://stackoverflow.com/questions/21783079/ajax-in-chrome-sending-options-instead-of-get-post-put-delete


#5

Ok, later, I found this also. but in my opinion you CANNOT SAY inside of the docs that except of the sync vs async the methods are the same on the client vs. server if there is this kind of difference. It cost me like 2 hours to find that out, because the times before I used that only on the server or on the same host and there of course no OPTIONS-Call is made and the code is excaclty the same but this time my method was just called from the client instead of the server.


#6

Mind sending a PR to the docs to improve this? https://github.com/meteor/docs/blob/master/source/api/http.md