Skip to content
This repository has been archived by the owner on Dec 12, 2022. It is now read-only.

Accept JSON POST data #65

Open
DEGoodmanWilson opened this issue Oct 5, 2018 · 2 comments
Open

Accept JSON POST data #65

DEGoodmanWilson opened this issue Oct 5, 2018 · 2 comments

Comments

@DEGoodmanWilson
Copy link
Owner

At the moment, on POST endpoints, we only accept application/x-www-form-urlencoded parameters for validation in router::handle_request. We don't even check the Content-Type header. Add support for application/json-encoded data as well.

@rjalfa
Copy link

rjalfa commented Oct 6, 2018

For application/json, what should the validations look like?

@DEGoodmanWilson
Copy link
Owner Author

A really excellent question, because of course JSON data could be totally free-form, and not at all a set of key-value pairs.

This is also a bit bigger than validation. There is a unordered_map of query parameters that gets passed in as well, and that maybe should be populated.

Perhaps what we could do is see if the JSON is an object, and then validate the object members as though they were a listing of key-value pairs. Then also populate the query parameter map.

I'm not 💯 on board with this idea, though. Maybe there are better ideas.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants