【发布时间】:2016-06-09 18:26:39
【问题描述】:
我需要发送 POST 请求并从中获取 json。
Create Http Context emopstest.pdc.org http
Set Request Header Content-Type application/x-www-form-urlencoded
Set Request Header Authorization Basic bG9naW46cGFzcw==
${dict}= Create Dictionary app_ids=18 where=ROWNUM<=2000
${value}= Stringify Json ${dict}
Set Request Body ${value}
HttpLibrary.HTTP.POST /auth_srv/services/auth/1/json/get_hazards
Show Response Body In Browser
Response Status Code Should Equal 200
${result_text}= Get Response Body
${result_json}= Parse Json ${result_text}
但是这段代码返回给我 404... 怎么了?
【问题讨论】:
-
很难给出太多建议,因为我们对您正在使用的东西知之甚少。如您所知,404 表示未找到,您的 POST 不成功。 URL 绝对正确吗?您的标题是否正常工作且正确?当您使用 POSTMAN 或 DHC 之类的方法执行相同的请求时,它会成功吗?返回了哪些错误?哪些关键字失败了,返回了什么?
标签: json post httpresponse robotframework