Angular2 Response for preflight is invalid (redirect) from some GET requests

送分小仙女□ 提交于 2019-12-11 02:07:07

问题


I am using Angular2, Communicating with a rest API, settings the header like so:

import { Headers } from '@angular/http';

export const contentHeaders = new Headers();
contentHeaders.append('Accept', 'application/json');
contentHeaders.append('Content-Type', 'application/json');
contentHeaders.append('Authorization', localStorage.getItem('id_token'));

Get request like items/ and POST request works, but when making GET requests for one item, like: items/579212a6541d5626732619c3 the server respond with a server error Response for preflight is invalid (redirect)

I thought those get requests are the same, but maybe they are not ? Any solutions ?


回答1:


Redirect + says that you are probably being redirected from that particular request. Are you sure that the ID of item is handled correctly on a backend?



来源:https://stackoverflow.com/questions/38716357/angular2-response-for-preflight-is-invalid-redirect-from-some-get-requests

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!