Skip to content

Commit

Permalink
Merge pull request netbox-community#176 from iceking2nd/master
Browse files Browse the repository at this point in the history
fix deserialization error when api was not en-US
  • Loading branch information
v0ctor authored Aug 7, 2024
2 parents 310bff3 + 0f60ca3 commit 45a579a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (

const authHeaderName = "Authorization"
const authHeaderFormat = "Token %v"
const languageHeaderName = "Accept-Language"
const languageHeaderValue = "en-US"

func NewAPIClientFor(host string, token string) *APIClient {
cfg := NewConfiguration()
Expand All @@ -17,5 +19,10 @@ func NewAPIClientFor(host string, token string) *APIClient {
fmt.Sprintf(authHeaderFormat, token),
)

cfg.AddDefaultHeader(
languageHeaderName,
languageHeaderValue,
)

return NewAPIClient(cfg)
}

0 comments on commit 45a579a

Please sign in to comment.