refactor for content type

refactor for content type
This commit is contained in:
coderfengyun 2014-09-29 14:10:11 +08:00
parent 6a192c9c4a
commit 15ac6877a4
1 changed files with 6 additions and 1 deletions

View File

@ -117,7 +117,7 @@ public class HttpPlugin extends ParameterBarn {
return uri; return uri;
} }
@Behavior(value = "Get", type = BehaviorType.USER_BEHAVIOR) @Behavior(value = "Batch", type = BehaviorType.USER_BEHAVIOR)
public List<HttpReturn> batchRequest( public List<HttpReturn> batchRequest(
@Parameter(value = "requests", type = SupportTypes.Table) String requests) { @Parameter(value = "requests", type = SupportTypes.Table) String requests) {
ExecutorService executorService = Executors.newFixedThreadPool(2); ExecutorService executorService = Executors.newFixedThreadPool(2);
@ -248,6 +248,11 @@ public class HttpPlugin extends ParameterBarn {
doExtractResponseVariablesAndSave(respVarsToSaveInSession, doExtractResponseVariablesAndSave(respVarsToSaveInSession,
method.getResponseBodyAsString()); method.getResponseBodyAsString());
} }
int pos = -1;
if (!contentType.isEmpty()
&& (pos = contentType.indexOf(';')) != -1) {
contentType = contentType.substring(0, pos).toLowerCase();
}
return new HttpReturn((responseCode % 100) < 4, responseCode, return new HttpReturn((responseCode % 100) < 4, responseCode,
method.getURI().toString(), contentLength, contentType, method.getURI().toString(), contentLength, contentType,
responseHeaders); responseHeaders);