Skip to content

Commit

Permalink
change authorization to authorization token
Browse files Browse the repository at this point in the history
  • Loading branch information
cauta committed Apr 13, 2024
1 parent c87b051 commit 1fd1aeb
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion db/migrations/000001_create_initial_schema.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CREATE TABLE IF NOT EXISTS webhooks(
content_type VARCHAR NOT NULL,
valid_status_codes SMALLINT[] NOT NULL,
secret_token VARCHAR NOT NULL,
"authorization" VARCHAR NOT NULL,
authorization_token VARCHAR NOT NULL,
active BOOLEAN NOT NULL,
max_delivery_attempts SMALLINT NOT NULL,
delivery_attempt_timeout SMALLINT NOT NULL,
Expand Down
2 changes: 1 addition & 1 deletion entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type Webhook struct {
ContentType string `json:"content_type" db:"content_type"`
ValidStatusCodes pq.Int32Array `json:"valid_status_codes" db:"valid_status_codes"`
SecretToken string `json:"secret_token" db:"secret_token"`
Authorization string `json:"authorization" db:"authorization"`
AuthorizationToken string `json:"authorization_token" db:"authorization_token"`
Active bool `json:"active" db:"active"`
MaxDeliveryAttempts int `json:"max_delivery_attempts" db:"max_delivery_attempts"`
DeliveryAttemptTimeout int `json:"delivery_attempt_timeout" db:"delivery_attempt_timeout"`
Expand Down
2 changes: 1 addition & 1 deletion http/handler/webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func makeWebhook() postmand.Webhook {
ContentType: "application/json",
ValidStatusCodes: pq.Int32Array{200, 201},
SecretToken: "",
Authorization: "",
AuthorizationToken: "",
Active: true,
MaxDeliveryAttempts: 1,
DeliveryAttemptTimeout: 1,
Expand Down
4 changes: 2 additions & 2 deletions repository/delivery.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ func dispatchToURL(webhook *postmand.Webhook, delivery *postmand.Delivery) dispa
request.Header.Set("X-Hub-Signature", hex.EncodeToString(hash.Sum(nil)))
}

if webhook.Authorization != "" {
request.Header.Set("Authorization", webhook.Authorization)
if webhook.AuthorizationToken != "" {
request.Header.Set("Authorization", webhook.AuthorizationToken)
}

// Create request dump
Expand Down

0 comments on commit 1fd1aeb

Please sign in to comment.