Understand MISSING_PARAMS #412
VincentTam
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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