我一直在使用 RobotFramework 發送 POST 請求我的代碼如下:
*** Settings ***
Library RequestsLibrary
Library JSONLibrary
Library Collections
*** Variables ***
${API_Base_Endpoint} http://thetestingworldapi.com/
*** Test Cases ***
Post_Req_Test
Create Session AddData ${API_Base_Endpoint}
${body}= create dictionary first_name=Tester1 middle_name=NAN last_name=Tester2 date_of_birth=01/01/1999
LOG TO CONSOLE ${body}
${header}= create dictionary Content-Type=application/json
${response}= post on session AddData api/studentsDetails data=${body} headers=${header}
但由于某種原因,我收到“HTTPError:400 客戶端錯誤:對 url 的錯誤請求:http: //thetestingworldapi.com/api/studentsDetails”
我嘗試通過 Postman 發送相同的請求,并且沒有問題。
有什么想法可能會出錯嗎?
uj5u.com熱心網友回復:
在@MatthewKing 的幫助下,我參考了這個解決方案為我作業
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/426768.html
標籤:邮政 机器人框架 http-status-code-400
