Skip to content

[Bug/Feature Request/] Strip priority of quotes/apostrophes to prevent marshal cast error #870

@OdinVex

Description

@OdinVex

Is your feature request related to a problem? Please describe.
Several backends I use for API automation (such as Huginn) try passing every JSON parameter and value enclosed in quotes, such as "priority": "10". This causes Gotify to return a 400 because "10" is being passed to the API instead of 10, in this example.

Describe the solution you'd like
Allow for some flexibility in the parameter for parsing as string->int or int by removing quotes/apostrophes so either becomes capable.

Describe alternatives you've considered
Rewriting various backends/other software, but that's insurmountable.

Additional context
message API, title, priority, message are all set. Ex:

{
  "title": "...",
  "priority": "10",
  "message": "...",
  "body": "{\"error\":\"Bad Request\",\"errorCode\":400,\"errorDescription\":\"json: cannot unmarshal string into Go struct field MessageExternal.priority of type int\"}",
  "status": 400,
  "headers": {
    ... Removed for Brevity ...
  }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions