在node上处理OPTIONS请求
学习cors跨域问题种,非简单请求时,浏览器会发送一个预请求询问服务端,能否通过同源策略检查,这个预请求是OPTIONS类型的。
在使用原生node构建的服务中,需要对OPTIONS请求方法进行处理。
const http = require('http');
http
.createServer(function (request, response) {
if (request.method == 'OPTIONS')</
const http = require('http');
http
.createServer(function (request, response) {
if (request.method == 'OPTIONS')</