当我在jmeter中发送get方法请求时,它给我一个错误java.net.URISyntaxException:索引路径中的非法字符

时间:2016-03-05 08:58:25

标签: jmeter

当我在jmeter中发送GET方法请求时,它给我一个错误

响应:

java.net.URISyntaxException: Illegal character in path at index 63: http://52.30.181.28:9000/PlatformServices/api/v2.0/kartCharges/{"pincode":560001,"gatewayPaymentMode":"NA","kartInfo":[{"sellerId":"S10014","qty":30,"unitPrice":1999,"sku":"SKU0100"}]}
    at java.net.URI$Parser.fail(URI.java:2848)
    at java.net.URI$Parser.checkChars(URI.java:3021)
    at java.net.URI$Parser.parseHierarchical(URI.java:3105)
    at java.net.URI$Parser.parse(URI.java:3053)
    at java.net.URI.<init>(URI.java:588)
    at java.net.URL.toURI(URL.java:939)
    at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:286)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1146)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1135)
    at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:434)
    at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:261)
    at java.lang.Thread.run(Thread.java:745)

请求:

GET http://52.30.181.28:9000/PlatformServices/api/v2.0/kartCharges/{"pincode":560001,"gatewayPaymentMode":"NA","kartInfo":[{"sellerId":"S10014","qty":30,"unitPrice":1999,"sku":"SKU0100"}]}

[没有饼干]

1 个答案:

答案 0 :(得分:2)

您的请求正文采用json格式。

因此,在HTTP标头管理器中,将content-type添加为application / json。

然后将以下部分放在url中:  http://52.30.181.28:9000/PlatformServices/api/v2.0/kartCharges/

在身体部位休息。     = { “pin码”:560001 “gatewayPaymentMode”: “NA”, “kartInfo”:[{ “sellerId”: “S10014”, “数量”:30, “单价”:1999, “SKU”: “SKU0100”} ]}