Skip to content

Commit 502ee48

Browse files
github-actions[bot]dorzepowski
authored andcommitted
docs: correct error descriptions and improve comments in payment middleware
1 parent 4e50d8a commit 502ee48

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

pkg/internal/payment/errors.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ var (
5959
ErrInvalidDerivationPrefix = ErrorResponse{
6060
StatusCode: http.StatusBadRequest,
6161
Code: ErrCodeInvalidPrefix,
62-
Description: "The X-BSV-Payment header Derivation Prefix is not valid. Must be the same as the one provided one.",
62+
Description: "The X-BSV-Payment header Derivation Prefix is not valid.",
6363
}
6464
ErrInvalidDerivationSuffix = ErrorResponse{
6565
StatusCode: http.StatusBadRequest,

pkg/internal/payment/middleware.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ func (m *Middleware) respondWith(w http.ResponseWriter, resp Response) {
110110
err := json.NewEncoder(w).Encode(resp)
111111
if err != nil {
112112
m.log.Error("Error writing response body", slog.Any("response", resp), slogx.Error(err))
113-
return
114113
}
115114
}
116115

pkg/middleware/payment_middleware.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
)
1111

1212
const (
13-
// HeaderPaymentPaid is the name of the header with confirmation of the payed amount.
13+
// HeaderPaymentPaid is the name of the header with confirmation of the paid amount.
1414
HeaderPaymentPaid = payment.HeaderSatoshisPaid
1515
)
1616

@@ -29,7 +29,7 @@ func WithPaymentLogger(logger *slog.Logger) func(*PaymentMiddlewareConfig) {
2929
}
3030
}
3131

32-
// WithRequestPriceCalculator sets a custom function to calculate the price of a request in satoshis for a payment middleware.
32+
// WithRequestPriceCalculator sets a custom function to calculate the price of a request in satoshis for payment middleware.
3333
func WithRequestPriceCalculator(calculator func(r *http.Request) (int, error)) func(*PaymentMiddlewareConfig) {
3434
if calculator == nil {
3535
panic("calculator must be provided")

0 commit comments

Comments
 (0)