Skip to content

Commit

Permalink
chore: Apply auth patch
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-paliychuk committed Apr 2, 2024
1 parent 8aff694 commit 628d200
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
15 changes: 15 additions & 0 deletions auth.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/core/request_option.go b/core/request_option.go
index 1df423d..1409b3a 100644
--- a/core/request_option.go
+++ b/core/request_option.go
@@ -42,7 +42,9 @@ func NewRequestOptions(opts ...RequestOption) *RequestOptions {
// for the request(s).
func (r *RequestOptions) ToHeader() http.Header {
header := r.cloneHeader()
- header.Set("Authorization", fmt.Sprintf("Api-Key %v", r.APIKey))
+ if r.APIKey != "" {
+ header.Set("Authorization", fmt.Sprintf("Api-Key %v", r.APIKey))
+ }
return header
}

4 changes: 3 additions & 1 deletion core/request_option.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ func NewRequestOptions(opts ...RequestOption) *RequestOptions {
// for the request(s).
func (r *RequestOptions) ToHeader() http.Header {
header := r.cloneHeader()
header.Set("Authorization", fmt.Sprintf("Api-Key %v", r.APIKey))
if r.APIKey != "" {
header.Set("Authorization", fmt.Sprintf("Api-Key %v", r.APIKey))
}
return header
}

Expand Down

0 comments on commit 628d200

Please sign in to comment.