You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Problem
During setup, one might run into
MISSING_PARAMS
.Raison d'être
Among the issues found with this error code:
https://github.com/eduardoboucas/staticman/issues?q=MISSING_PARAMS
none of them gives a simple explanation of this error.
Goal
Get response 200 or 302 from the API instance.
Discussion
Comparison with URL encoded form
When the content type is URL encoded form (
x-www-urlencoded
), the following request works.🔗 https://git.io/smdemo
Conversion to JSON string
One might want to use
JSON.stringify
to convert the form data to a JSON-friendly string.ℹ️ I learnt using
Object.fromEntries()
withnew FormData()
from Go Make Things.The last line gives a condensed object which can be prettified to the object shown in the first screenshot.
💡 I omit
options[redirect]
in the JSON for simplicity.The server responses with
MISSING_PARAMS
.The API server is expecting something like
instead of
Solution
The solution is illustrated in screenshot in the goal. The request JSON's
field
has to represent an object containing the key-value pairs. For a sample implementation, you may consult @'s functions athttps://github.com/onweru/hugo-swift-theme/blob/7a42577d943fc6e267be410683a551b8367df563/assets/js/index.js#L281
in a repo that I was invited as a collaborator.
Beta Was this translation helpful? Give feedback.
All reactions