Skip to content

Commit

Permalink
Merge pull request #8 from systemli/Fix-Authorization-Header
Browse files Browse the repository at this point in the history
  • Loading branch information
0x46616c6b authored Oct 2, 2024
2 parents 108c83d + 5460351 commit 322abaf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion userli.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (u *Userli) call(url string) (*http.Response, error) {
return nil, err
}

req.Header.Set("Authentication", fmt.Sprintf("Bearer %s", u.token))
req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", u.token))

req.Header.Set("Accept", "application/json")
req.Header.Set("Content-Type", "application/json")
Expand Down
22 changes: 11 additions & 11 deletions userli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func (s *UserliTestSuite) TestGetAliases() {
s.Run("success", func() {
gock.New("http://localhost:8000").
Get("/api/postfix/alias/alias@example.com").
MatchHeader("Authentication", "Bearer insecure").
MatchHeader("Authorization", "Bearer insecure").
MatchHeader("Accept", "application/json").
MatchHeader("Content-Type", "application/json").
MatchHeader("User-Agent", "userli-postfix-adapter").
Expand All @@ -40,7 +40,7 @@ func (s *UserliTestSuite) TestGetAliases() {
s.Run("error", func() {
gock.New("http://localhost:8000").
Get("/api/postfix/alias/alias@example.com").
MatchHeader("Authentication", "Bearer insecure").
MatchHeader("Authorization", "Bearer insecure").
MatchHeader("Accept", "application/json").
MatchHeader("Content-Type", "application/json").
MatchHeader("User-Agent", "userli-postfix-adapter").
Expand All @@ -58,7 +58,7 @@ func (s *UserliTestSuite) TestGetDomain() {
s.Run("success", func() {
gock.New("http://localhost:8000").
Get("/api/postfix/domain/example.com").
MatchHeader("Authentication", "Bearer insecure").
MatchHeader("Authorization", "Bearer insecure").
MatchHeader("Accept", "application/json").
MatchHeader("Content-Type", "application/json").
MatchHeader("User-Agent", "userli-postfix-adapter").
Expand All @@ -73,7 +73,7 @@ func (s *UserliTestSuite) TestGetDomain() {
s.Run("not found", func() {
gock.New("http://localhost:8000").
Get("/api/postfix/domain/example.com").
MatchHeader("Authentication", "Bearer insecure").
MatchHeader("Authorization", "Bearer insecure").
MatchHeader("Accept", "application/json").
MatchHeader("Content-Type", "application/json").
MatchHeader("User-Agent", "userli-postfix-adapter").
Expand All @@ -89,7 +89,7 @@ func (s *UserliTestSuite) TestGetDomain() {
s.Run("error", func() {
gock.New("http://localhost:8000").
Get("/api/postfix/domain/example.com").
MatchHeader("Authentication", "Bearer insecure").
MatchHeader("Authorization", "Bearer insecure").
MatchHeader("Accept", "application/json").
MatchHeader("Content-Type", "application/json").
MatchHeader("User-Agent", "userli-postfix-adapter").
Expand All @@ -107,7 +107,7 @@ func (s *UserliTestSuite) TestGetMailbox() {
s.Run("success", func() {
gock.New("http://localhost:8000").
Get("/api/postfix/mailbox/user@example.org").
MatchHeader("Authentication", "Bearer insecure").
MatchHeader("Authorization", "Bearer insecure").
MatchHeader("Accept", "application/json").
MatchHeader("Content-Type", "application/json").
MatchHeader("User-Agent", "userli-postfix-adapter").
Expand All @@ -123,7 +123,7 @@ func (s *UserliTestSuite) TestGetMailbox() {
s.Run("not found", func() {
gock.New("http://localhost:8000").
Get("/api/postfix/mailbox/user@example.org").
MatchHeader("Authentication", "Bearer insecure").
MatchHeader("Authorization", "Bearer insecure").
MatchHeader("Accept", "application/json").
MatchHeader("Content-Type", "application/json").
MatchHeader("User-Agent", "userli-postfix-adapter").
Expand All @@ -139,7 +139,7 @@ func (s *UserliTestSuite) TestGetMailbox() {
s.Run("error", func() {
gock.New("http://localhost:8000").
Get("/api/postfix/mailbox/user@example.org").
MatchHeader("Authentication", "Bearer insecure").
MatchHeader("Authorization", "Bearer insecure").
MatchHeader("Accept", "application/json").
MatchHeader("Content-Type", "application/json").
MatchHeader("User-Agent", "userli-postfix-adapter").
Expand All @@ -157,7 +157,7 @@ func (s *UserliTestSuite) TestGetSenders() {
s.Run("success", func() {
gock.New("http://localhost:8000").
Get("/api/postfix/senders/user@example.com").
MatchHeader("Authentication", "Bearer insecure").
MatchHeader("Authorization", "Bearer insecure").
MatchHeader("Accept", "application/json").
MatchHeader("Content-Type", "application/json").
MatchHeader("User-Agent", "userli-postfix-adapter").
Expand All @@ -173,7 +173,7 @@ func (s *UserliTestSuite) TestGetSenders() {
s.Run("alias success", func() {
gock.New("http://localhost:8000").
Get("/api/postfix/senders/alias@example.com").
MatchHeader("Authentication", "Bearer insecure").
MatchHeader("Authorization", "Bearer insecure").
MatchHeader("Accept", "application/json").
MatchHeader("Content-Type", "application/json").
MatchHeader("User-Agent", "userli-postfix-adapter").
Expand All @@ -189,7 +189,7 @@ func (s *UserliTestSuite) TestGetSenders() {
s.Run("error", func() {
gock.New("http://localhost:8000").
Get("/api/postfix/senders/user@example.com").
MatchHeader("Authentication", "Bearer insecure").
MatchHeader("Authorization", "Bearer insecure").
MatchHeader("Accept", "application/json").
MatchHeader("Content-Type", "application/json").
MatchHeader("User-Agent", "userli-postfix-adapter").
Expand Down

0 comments on commit 322abaf

Please sign in to comment.