зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1278923
- Export Content-Type and Content-Length to HAR headers. r=Honza
MozReview-Commit-ID: H0eZ8bSId8Q --HG-- extra : transplant_source : M%DC%E7%E0%80%0E%87%13%0A%E0%F5j%EAg5%81%FBM%09%97
This commit is contained in:
Родитель
afbca2c80e
Коммит
fcbeb531eb
|
@ -165,6 +165,7 @@ HarBuilder.prototype = {
|
||||||
request.httpVersion = file.httpVersion || "";
|
request.httpVersion = file.httpVersion || "";
|
||||||
|
|
||||||
request.headers = this.buildHeaders(file.requestHeaders);
|
request.headers = this.buildHeaders(file.requestHeaders);
|
||||||
|
request.headers = this.appendHeadersPostData(request.headers, file);
|
||||||
request.cookies = this.buildCookies(file.requestCookies);
|
request.cookies = this.buildCookies(file.requestCookies);
|
||||||
|
|
||||||
request.queryString = NetworkHelper.parseQueryString(
|
request.queryString = NetworkHelper.parseQueryString(
|
||||||
|
@ -199,6 +200,33 @@ HarBuilder.prototype = {
|
||||||
return this.buildNameValuePairs(input.headers);
|
return this.buildNameValuePairs(input.headers);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
appendHeadersPostData: function (input = [], file) {
|
||||||
|
if (!file.requestPostData) {
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.fetchData(file.requestPostData.postData.text).then(value => {
|
||||||
|
let contentType = value.match(/Content-Type: ([^;\s]+)/);
|
||||||
|
let contentLength = value.match(/Content-Length: (.+)/);
|
||||||
|
|
||||||
|
if (contentType && contentType.length > 1) {
|
||||||
|
input.push({
|
||||||
|
name: "Content-Type",
|
||||||
|
value: contentType[1]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (contentLength && contentLength.length > 1) {
|
||||||
|
input.push({
|
||||||
|
name: "Content-Length",
|
||||||
|
value: contentLength[1]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return input;
|
||||||
|
},
|
||||||
|
|
||||||
buildCookies: function (input) {
|
buildCookies: function (input) {
|
||||||
if (!input) {
|
if (!input) {
|
||||||
return [];
|
return [];
|
||||||
|
|
Загрузка…
Ссылка в новой задаче