When making an Ajax request using AngularJS, I encountered a problem with the $http
method. It works well with both get
and post
requests, but throws an error with put
.
Response Header :
Access-Control-Allow-Headers:Origin, X-Requested-With, Content-Type, Accept, Accept-Encoding, Accept-Language, Host, Referer, User-Agent, X-API-KEY
Access-Control-Allow-Methods:OPTIONS
Access-Control-Allow-Origin:*
Access-Control-Max-Age:1728000
Content-Length:0
Date:Mon, 25 Jan 2016 08:44:05 GMT
Server:spray-can/1.3.2
Request Header :
Accept:*/*
Accept-Encoding:gzip, deflate, sdch
Accept-Language:en-US,en;q=0.8,hi;q=0.6
Access-Control-Request-Headers:accept, content-type, x-api-key
Access-Control-Request-Method:PUT
Connection:keep-alive
Host:localhost:8080
Origin:http://localhost:8000
Referer:http://localhost:8000/
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36