dreamhead / moco

Easy Setup Stub Server
MIT License
4.36k stars 1.08k forks source link

What shoule i do #286

Open 1561986217 opened 3 years ago

1561986217 commented 3 years ago

I use the HttpUtil.post to connection the mock,. Here is my config image. Then i got the response image what should i do.

1561986217 commented 3 years ago

sorry ,the image is bad

1561986217 commented 3 years ago

image1 image2

1561986217 commented 3 years ago

this is my config` { "request" : { "uri" : "/webservice/PublicService.asmx/abc", "method":"post", "headers" : { "content-type" : "application/x-www-form-urlencoded" }, "forms":{ "refrence_no":"XWKH3371", "shipping_method":"ZHHY" } }, "response" : { "json":{ "success": "1", "data": { "shipping_method_no": "384924608754", "refrence_no": "XWKHB355", "order_id":"01"

    }
  }
}`
1561986217 commented 3 years ago

here is my response `POST /webservice/PublicService.asmx/abc HTTP/1.0 Accept: text/html,application/json,application/xhtml+xml,application/xml;q=0.9,/;q=0.8 Connection: close User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36 Hutool Host: mock-server.lookout123.cn REMOTE-HOST: 117.89.114.47 Accept-Encoding: gzip, deflate Pragma: no-cache Cache-Control: no-cache X-Forwarded-For: 117.89.114.47 Accept-Language: zh-CN,zh;q=0.8 Content-Length: 91 X-Real-IP: 117.89.114.47 Content-Type: application/x-www-form-urlencoded;charset=UTF-8

paramsJson=%7Bshipping_method%3DZHHY%2C+refrence_no%3DXWKH3371%7D&serviceMethod=createorder

24 Sep 2020 15:57:17 [pool-1-thread-10] INFO Response return:

HTTP/1.0 400`

1561986217 commented 3 years ago

i need help

dreamhead commented 3 years ago

@1561986217

paramsJson=%7Bshipping_method%3DZHHY%2C+refrence_no%3DXWKH3371%7D&serviceMethod=createorde

Here is your request, not response.

Content-Type header in your request contains charset, which you didn't match in your configuration.

1561986217 commented 3 years ago

Can't mock parse this encoded request parameter? I use the httputils tool. For requests sent by post method, the parameters will be encoded in hexadecimal

dreamhead commented 3 years ago

@1561986217 It seems your request fail to match Content-Type.

1561986217 commented 3 years ago

yes,i got it .But how to solve it ?

dreamhead commented 3 years ago

@1561986217 You have 2 solutions: