javascript - How to send cookie in each request header in angularjs? -
hi in developing angularjs web application. using api's data. on login successful data in cookie(response header). in next subsequent http calls need send cookies data apis. below snapshot of response header.
below sample $http call.
var req = { method: 'post', url: savepersonaldetailsurl, headers: { requestedplatform: "web", requestedlanguage: cookiepreferredlanguage }, data: { loginid: loginid } $http(req).then(function (response) { //do here }, function (error) { toastr.error($filter('translate')('error occured')); });
on each http call want send cookie in header. may know how can done in angularjs? appreciated. thank you.
one of features of cookies they're sent server each request. make sure domain request being made same domain set or sub domain.
the cookie stored browser, , cookie sent requests made same server inside cookie http header - https://developer.mozilla.org/en-us/docs/web/http/cookies
Comments
Post a Comment