Skip to content

Allow Payload to be case-insensitive #108

Description

@jwoertink

Crystal's JSON is case-sensitive, which means this throws an error:

struct Payload
  include JSON::Serializable
 
  @[JSON::Field]
  getter command : String
end

# Unhandled exception: Missing JSON attribute: command
Payload.from_json(%({"Command": "Subscribe"}))

Also, since we're checking against a case sensitive value, that Subscribe also fails

return subscribe(payload) if payload.command == "subscribe"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions