Skip to content

Commit

Permalink
refactor: 优化代码
Browse files Browse the repository at this point in the history
  • Loading branch information
q4speed committed Aug 4, 2020
1 parent 6e852fa commit 52c5216
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions frontend/src/business/components/api/test/model/ScenarioModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ export class HttpRequest extends Request {
}
}
} else {
if (!this.url) {
if (!this.url) {
return {
isValid: false,
info: 'api_test.request.input_url'
Expand Down Expand Up @@ -684,7 +684,7 @@ class JMXHttpRequest {
for (let i = 0; i < parameters.length; i++) {
let parameter = parameters[i];
path += (encodeURIComponent(parameter.name) + '=' + encodeURIComponent(parameter.value));
if (i != parameters.length -1) {
if (i !== parameters.length - 1) {
path += '&';
}
}
Expand Down Expand Up @@ -860,9 +860,11 @@ class JMXGenerator {

addContentType(request, type) {
for (let index in request.headers) {
if (request.headers[index].name == 'Content-Type') {
request.headers.splice(index, 1);
break;
if (request.headers.hasOwnProperty(index)) {
if (request.headers[index].name === 'Content-Type') {
request.headers.splice(index, 1);
break;
}
}
}
request.headers.push(new KeyValue('Content-Type', type));
Expand Down

0 comments on commit 52c5216

Please sign in to comment.