-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(gotify): handle token ending in / (#235)
- Loading branch information
Showing
7 changed files
with
122 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package testutils | ||
|
||
import "net/http" | ||
|
||
// MockClientService is used to allow mocking the HTTP client when testing | ||
type MockClientService interface { | ||
GetHTTPClient() *http.Client | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,27 @@ | ||
package gotify | ||
|
||
// JSON is the actual payload being sent to the Gotify API | ||
type JSON struct { | ||
import "fmt" | ||
|
||
// messageRequest is the actual payload being sent to the Gotify API | ||
type messageRequest struct { | ||
Message string `json:"message"` | ||
Title string `json:"title"` | ||
Priority int `json:"priority"` | ||
} | ||
|
||
type messageResponse struct { | ||
messageRequest | ||
ID uint64 `json:"id"` | ||
AppID uint64 `json:"appid"` | ||
Date string `json:"date"` | ||
} | ||
|
||
type errorResponse struct { | ||
Name string `json:"error"` | ||
Code uint64 `json:"errorCode"` | ||
Description string `json:"errorDescription"` | ||
} | ||
|
||
func (er *errorResponse) Error() string { | ||
return fmt.Sprintf("server respondend with %v (%v): %v", er.Name, er.Code, er.Description) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters