Skip to content

Stop crashing on non-hash json#697

Merged
andrehjr merged 2 commits intosplitrb:mainfrom
knarewski:stop-crashing-on-non-hash-json
Sep 17, 2022
Merged

Stop crashing on non-hash json#697
andrehjr merged 2 commits intosplitrb:mainfrom
knarewski:stop-crashing-on-non-hash-json

Conversation

@knarewski
Copy link
Contributor

Problem
When split cookie is a valid, json encoded String, a NoMethodError is raised. (See #695 )

Solution
Add an empty hash fallback for unsupported types

Resolves #695

Notes

  • The pre-existing test for invalid JSON seemed broken, so I (hopefully) fixed it

The cookie adapter uses string as a key, so should the spec. Also, context.request.cookies is a hash
in both cases, it feels that it should be set directly, not using a hash with "value" and "expires" keys.
Copy link
Member

@andrehjr andrehjr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@andrehjr andrehjr merged commit 5b86061 into splitrb:main Sep 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When split cookie is a valid, json encoded String, a NoMethodError is raised

2 participants