Skip to content

Commit

Permalink
Set Accept header to application/json
Browse files Browse the repository at this point in the history
Scryfall has requested that clients set the Accept header. Lets do that
to avoid getting blocked.

Fixes #32
  • Loading branch information
BlueMonday committed Dec 15, 2024
1 parent 816eeef commit 776c119
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Changelog

## 0.6.0
## 0.6.1
* Set Accept header to application/json

## 0.6.0
* Add version to User-Agent header
* Add WithUserAgent option to enable customization of the User-Agent header
4 changes: 3 additions & 1 deletion scryfall.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
)

const (
Version = "0.6.0"
Version = "0.6.1"

defaultBaseURL = "https://api.scryfall.com"
defaultUserAgent = "go-scryfall/" + Version
Expand Down Expand Up @@ -223,6 +223,8 @@ func NewClient(options ...ClientOption) (*Client, error) {

func (c *Client) doReq(ctx context.Context, req *http.Request, respBody interface{}) error {
req.Header.Set("User-Agent", c.userAgent)
req.Header.Set("Accept", "application/json")

if len(c.authorization) != 0 {
req.Header.Set("Authorization", c.authorization)
}
Expand Down

0 comments on commit 776c119

Please sign in to comment.