Page MenuHomePhabricator

Raise warning when accidentally submitting Conduit parameters as a JSON-encoded body

Authored by amckinley on Jan 3 2019, 1:26 AM.



See T12447 for discussion. It is reasonably intuitive to try and pass Conduit parameters via a JSON-encoded HTTP body, but if you do so, you'll get an unhelpful messsage about how method so-and-so does not accept a parameter named "your_entire_json_body". Instead, detect this mistake and advise developers to use form-encoded parameters.

Test Plan

Got a better error when attempting to make Conduit calls from React code. Tested the following additional invocations of Conduit and got the expected results without an error:

  • From the Conduit UI
  • With cURL:
~ $ curl \
>     -d api.token=api-tvv2zb565zrtueab5ddprmpxvrwb \
>     -d ids[0]=1
  • With arc call-conduit:
~ $ echo '{
>   "ids": [
>     1
>   ]
> }' | arc call-conduit --conduit-uri --conduit-token api-tvv2zb565zrtueab5ddprmpxvrwb conpherence.querythread

Diff Detail

rP Phabricator
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

amckinley created this revision.Jan 3 2019, 1:26 AM
amckinley requested review of this revision.Jan 3 2019, 1:28 AM
epriestley accepted this revision.Jan 3 2019, 1:30 AM
This revision is now accepted and ready to land.Jan 3 2019, 1:30 AM
This revision was automatically updated to reflect the committed changes.