使用Python+unittest完成web接口測試用例,調用post方法是,一直返回錯誤報文:
{"msg":"JSON parse error: Cannot construct instance of `xxxxx` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value (''); nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of `xxxxx` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('')\n at [Source: (PushbackInputStream); line: 1, column: 1]","code":500,"data":null
糾結了很久,網上也查詢了,也請教了Java開發,結果發現是post請求的參數寫錯導致,心中頓時幾千萬個那什么呼嘯而過,這個問題的原因也太簡單了,也是因為自己對各個請求方法的傳參不夠熟練導致(但是這個錯誤提示也夠奇葩的,直接提示我參數傳遞錯誤就行呀。。。)
錯誤的請求樣例:
正確的請求樣例: