diff --git a/db/migrations/000001_create_initial_schema.up.sql b/db/migrations/000001_create_initial_schema.up.sql index 2644634..1804341 100644 --- a/db/migrations/000001_create_initial_schema.up.sql +++ b/db/migrations/000001_create_initial_schema.up.sql @@ -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, diff --git a/entity.go b/entity.go index f861ff8..486e7aa 100644 --- a/entity.go +++ b/entity.go @@ -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"` diff --git a/http/handler/webhook_test.go b/http/handler/webhook_test.go index ecdb0e5..21d9112 100644 --- a/http/handler/webhook_test.go +++ b/http/handler/webhook_test.go @@ -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, diff --git a/repository/delivery.go b/repository/delivery.go index be41718..4a03a79 100644 --- a/repository/delivery.go +++ b/repository/delivery.go @@ -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