在POST请求中的索引53的路径中获取非法字符

时间:2019-02-01 23:54:59

标签: jmeter urlencode

我正在尝试发布HTTP请求,请求没有通过。我在做错什么或想念什么?

我认为它不喜欢这部分 colonoscopy.jpg / 1-1?

Server name: ${hostName} 
Path:  ${virtualDirectory}/data/media/${location}/colonoscopy.jpg/1-1?&prodName=${prodName}&otherParams=&sid=${authToken}

HTTP Header Manager
Content-Type application/x-www-form-urlencoded

获取

Thread Name: Thread Group 1-1
Sample Start: 2019-02-01 15:39:06 PST
Load time: 0
Connect Time: 0
Latency: 0
Size in bytes: 1681
Sent bytes:0
Headers size in bytes: 0
Body size in bytes: 1681
Sample Count: 1
Error Count: 1
Data type ("text"|"bin"|""): text
Response code: Non HTTP response code: java.net.URISyntaxException
Response message: Non HTTP response message: Illegal character in path at index 53: http://10.188.169.185/api/v2/data/media/dc2e83cfe2054
Server:%20Microsoft-IIS/10.0
Set-Cookie:%20ASP.NET_SessionId=5cwq0inclxwvmd0qlnd01yo3;%20path=/;%20HttpOnly
X-AspNet-Version:%204.0.30319
X-Powered-By:%20ASP.NET
Access-Control-Allow-Origin:%20*
Access-Control-Allow-Headers:%20Content-Type,Authorization
Access-Control-Expose-Headers:%20Content-Location,%20Location
Access-Control-Allow-Methods:%20GET,%20POST,%20OPTIONS,%20DELETE
Date:%20Fri,%2001%20Feb%202019%2023:39:05%20GMT
Content-Length:%200
colonoscopy.jpg/1-1?&prodName=test&otherParams=&sid=ca1bc7a576a44d9b8270b7cac2dddab8

HTTPSampleResult fields:
ContentType: 
DataEncoding: null

1 个答案:

答案 0 :(得分:0)

使用query string侦听器检查URL和View Results Tree,错误的原因可能只有一个:您发送的字符原样需要URL encoding

原因在:

  1. 您的变量之一(${location}${prodName}${authToken})具有需要URL编码的字符。如果是这种情况,则需要将其包装到__urlencode() function
  2. 您的一个变量(${location}${prodName}${authToken})未解析为值和花括号字符({和{{1 }})不允许未经编码的URL字符串。使用Debug Sampler来确保: