@
yunfeifan postman 插件里面的一个方法, 没法发现请求域的设置呢?
``
//Send the current request
send:function (responseRawDataType ) {
pm.request.prepareForSending ();
if (pm.request.url === "") {
return;
}
var originalUrl = $('#url').val (); //Store this for saving the request
var url = pm.request.encodeUrl (pm.request.url );
var method = pm.request.method.toUpperCase ();
var originalData = pm.request.body.getData (true );
//Start setting up XHR
var xhr = new XMLHttpRequest ();
xhr.open (method, url, true ); //Open the XHR request. Will be sent later
xhr.onreadystatechange = function (event ) {
pm.request.response.load (event.target );
};
//Response raw data type is used for fetching binary responses while generating PDFs
if (!responseRawDataType ) {
responseRawDataType = "text";
}
xhr.responseType = responseRawDataType;
var headers = pm.request.getXhrHeaders (headers );
for (var i = 0; i < headers.length; i++) {
xhr.setRequestHeader (headers[i].name, headers[i].value );
}
// Prepare body
if (pm.request.isMethodWithBody (method )) {
var body = pm.request.getRequestBodyToBeSent ();
if (body === false ) {
xhr.send ();
}
else {
xhr.send (body );
}
} else {
xhr.send ();
}
pm.request.response.iframeRefreshedRecently = false;
pm.request.xhr = xhr;
//Save the request
if (pm.settings.get ("autoSaveRequest")) {
pm.history.addRequest (originalUrl,
method,
pm.request.getPackedHeaders (),
originalData,
pm.request.dataMode );
}
//Show the final UI
pm.request.updateUiPostSending ();
},
``