Hi folks!
I am probably missing something with httpb, but the following config leads to an error:
elukey@deploy1002:~$ cat inference_staging.yaml https://enwiki-goodfaith.revscoring-editquality-goodfaith.wikimedia.org: - path: /v1/models/enwiki-goodfaith:predict request_headers: "Content-Type": "application/json" "Accept-Encoding": "application/json" form_body: "rev_id": 1234567 assert_status: 200 assert_body_contains: probability method: POST elukey@deploy1002:~$ httpbb --host inference-staging.svc.codfw.wmnet --https_port 30443 inference_staging.yaml Sending to inference-staging.svc.codfw.wmnet... https://enwiki-goodfaith.revscoring-editquality-goodfaith.wikimedia.org/v1/models/enwiki-goodfaith:predict (inference_staging.yaml:2) Status code: expected 200, got 400. Body: expected to contain 'probability', got '{"error":"Unrecognized request format: unexpected '... (87 characters total). === FAIL: 1 request sent to inference-staging.svc.codfw.wmnet. 1 request with failed assertions.
I tried to set up a minimal repro test case:
import requests import json r = requests.post('https://inference-staging.svc.codfw.wmnet:30443/v1/models/enwiki-goodfaith:predict', data={'rev_id': 123456789}, headers={"Content-type": "application/json", "Host": "enwiki-goodfaith.revscoring-editquality-goodfaith.wikimedia.org"}) print(f"Test 1: HTTP {r.status_code} and body {r.text}") r = requests.post('https://inference-staging.svc.codfw.wmnet:30443/v1/models/enwiki-goodfaith:predict', data=json.dumps({"rev_id": 123456}), headers={"Content-type": "application/json", "Host": "enwiki-goodfaith.revscoring-editquality-goodfaith.wikimedia.org"}) print(f"Test 2: HTTP {r.status_code} and body {r.text}") r = requests.post('https://inference-staging.svc.codfw.wmnet:30443/v1/models/enwiki-goodfaith:predict', json={'rev_id': 123456789}, headers={"Content-type": "application/json", "Host": "enwiki-goodfaith.revscoring-editquality-goodfaith.wikimedia.org"}) print(f"Test 3: HTTP {r.status_code} and body {r.text}")
This leads to:
Test 1: HTTP 400 and body {"error":"Unrecognized request format: unexpected character: line 1 column 1 (char 0)"} Test 2: HTTP 200 and body {"enwiki":{"models":{"goodfaith":{"version":"0.5.1"}},"scores":{"123456":{"goodfaith":{"score":{"prediction":true,"probability":{"false":0.03387957196040836,"true":0.9661204280395916}}}}}}} Test 3: HTTP 200 and body {"enwiki":{"models":{"goodfaith":{"version":"0.5.1"}},"scores":{"123456789":{"goodfaith":{"score":{"prediction":true,"probability":{"false":0.025037544564238123,"true":0.9749624554357619}}}}}}}
Is httpbb fully supporting JSON payloads for POSTs or is there anything to be added in the config that I am missing?