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
As it stands, Parser::Simple is, on its own, too simple.
While Endpoint splits responsibility between acceptance and rendering, Endpoint does no such thing between supported media types and parsing.
Why do we need granularity here? Well, the parser supports application/x-www-form-urlencoded and multipart/form-data by default. This seemed like a good idea at a time, but it actually makes Crepe a bit more difficult to step into because the first time you curl-debug, the params you expect to be parsed in from JSON will be nil unless you explicitly add -H "Content-Type: application/json". If it returned early with 415 Unsupported Media Type, it would be a lot easier to debug.
Renderer::Simple supports to_#{format} for any format by default, so we shouldn't need to get rid of form data support, but Renderer::Simple won't get hit at all if the format hasn't been whitelisted. We need the same ability to whitelist supported media types.
Support should be easy, but naming could be hard.
.respond_to handles acceptance, but will also shorthand-handle rendering with its **options of accepted formants to renderers.
.render handles renderers when Renderer::Simple is too simple.
.parse handles parsing.
How do things need to change?
One other thing to look into: do we properly convert application/vnd.name+json to application/json when parsing?
The text was updated successfully, but these errors were encountered:
As it stands, Parser::Simple is, on its own, too simple.
While Endpoint splits responsibility between acceptance and rendering, Endpoint does no such thing between supported media types and parsing.
Why do we need granularity here? Well, the parser supports
application/x-www-form-urlencoded
andmultipart/form-data
by default. This seemed like a good idea at a time, but it actually makes Crepe a bit more difficult to step into because the first time youcurl
-debug, the params you expect to be parsed in from JSON will benil
unless you explicitly add-H "Content-Type: application/json"
. If it returned early with415 Unsupported Media Type
, it would be a lot easier to debug.Renderer::Simple supports
to_#{format}
for any format by default, so we shouldn't need to get rid of form data support, but Renderer::Simple won't get hit at all if the format hasn't been whitelisted. We need the same ability to whitelist supported media types.Support should be easy, but naming could be hard.
.respond_to
handles acceptance, but will also shorthand-handle rendering with its**options
of accepted formants to renderers..render
handles renderers when Renderer::Simple is too simple..parse
handles parsing.How do things need to change?
One other thing to look into: do we properly convert
application/vnd.name+json
toapplication/json
when parsing?The text was updated successfully, but these errors were encountered: