JMeter发布请求-JSON解析错误:无效的UTF-8起始字节0xb0

时间:2019-05-27 12:44:26

标签: java json jmeter performance-testing jmeter-5.0

我正在使用JMeter发送以JSON为主体的发布请求。

我收到成功响应当我使用邮递员执行相同的请求时。

但是使用JMeter时,我收到“ JSON解析错误:无效的UTF-8起始字节0xb0”。

基于类似的问题,看来-(连字符)引起了问题,但并不确定100%。

这些是我尝试过的标头组合:

第一

  

内容类型:application / json; charset = utf-8

第二

  

内容类型:application / json

     

内容编码:utf-8

下面是JSON正文

{
   "note":"Test item note",
   "externalIds":[
      {
         "sourceId":"external-0",
         "value":"0003869",
         "type":{
            "key":"33501",
            "value":"Item #",
            "id":3686074
         },
         "_operation":0
      }
   ],
   "description":"TEST 16700654 ROTIS FC 2/5 LB",
   "country":"USA",
   "specialConditions":{
      "isHazmat":true,
      "isOdorSensitive":true
   },
   "status":{
      "code":{
         "id":538663,
         "key":"35001",
         "value":"active"
      }
   },
   "catchWeightType":{
      "id":538674,
      "key":"35051",
      "value":"Inbound"
   },
   "weights":[
      {
         "sourceId":"weights-0",
         "value":10,
         "type":{
            "key":"35301",
            "value":"Net Weight",
            "id":538701
         },
         "unit":{
            "key":"1520",
            "value":"lb"
         },
         "_operation":0
      }
   ],
   "packages":[
      {
         "sourceId":"package-0",
         "maxStackCount":25,
         "nmfc":"123",
         "nmfcSub":"chk87",
         "freightClass":{
            "id":100218,
            "value":"50",
            "key":"5100"
         },
         "value":{
            "value":100.5,
            "currency":{
               "id":100065,
               "value":"USD",
               "key":"1550"
            }
         },
         "temperature":{
            "unit":{
               "key":"1510",
               "value":"°F",
               "id":100058
            },
            "max":78,
            "min":-29.6
         },
         "weights":[
            {
               "unit":{
                  "key":"1520",
                  "value":"lb",
                  "id":100060
               },
               "value":100,
               "type":{
                  "key":"35303",
                  "value":"Tare Weight",
                  "id":538703
               },
               "sourceId":"weight-0",
               "_operation":0
            },
            {
               "unit":{
                  "key":"1520",
                  "value":"lb",
                  "id":100060
               },
               "value":298.7,
               "type":{
                  "key":"35301",
                  "value":"Net Weight",
                  "id":538701
               },
               "sourceId":"weight-1",
               "_operation":0
            }
         ],
         "packageUnit":{
            "key":"6022",
            "value":"cases",
            "id":114043
         },
         "isBaseUnit":true,
         "units":{
            "key":"1530",
            "value":"in",
            "id":100062
         },
         "height":8.813,
         "length":14.938,
         "width":9.438,
         "isStackable":true,
         "ti":13,
         "high":7,
         "_operation":0
      }
   ],
   "customId":"0006686",
   "is_odor_sensitive":true,
   "name":"TEST 16700654 ROTIS FC 2/5 LB",
   "location":{
      "id":632804
   },
   "shelfLife":{
      "value":365,
      "type":{
         "key":"35351",
         "value":"days",
         "id":538705
      }
   },
   "category":{
      "key":"22300",
      "value":"Other",
      "id":139708
   },
   "customer":{
      "id":476093
   }
}

1 个答案:

答案 0 :(得分:0)

也许您添加了空格或特殊字符。以下应该起作用:

  1. 在HTTP请求下添加HTTP Header Manager

  2. 在“名称”列中添加:Content-Type

  3. 在“值”列中添加:application/json;charset=UTF-8