gotify / gotify/server

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

Open
#870 11 comments 1 reaction 0 assignees View on GitHub
a:feature in:server request-for-comments
Dominant language
Go
Stars
15.9k
Forks
873
Avg merge
2d 22h
Merged PRs (30d)
6

Description

**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 ...
}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.