feat(api): define public problem errors, pagination, and retry contract
This commit is contained in:
1 parent
b2f6e87bfe
commit
565ca94bbb
86 files changed
+8200
-154
No files matched your search
@@ -3,9 +3,12 @@ package v1
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"lincodex/backend/internal/adapter/primary/http/problem"
|
||||
)
|
||||
|
||||
// Once the contract defines a default error response, ogen adds NewError to
|
||||
@@ -13,7 +16,7 @@ import (
|
||||
// status code, which the generated encoder sends as HTTP 200. A handler error
|
||||
// would then look like a success, so the composite must define its own NewError.
|
||||
func TestHandlerNewErrorDoesNotReportSuccess(t *testing.T) {
|
||||
newError := reflect.ValueOf(NewHandler(nil)).MethodByName("NewError")
|
||||
newError := reflect.ValueOf(NewHandler(nil, problem.NewResponder(slog.New(slog.DiscardHandler)))).MethodByName("NewError")
|
||||
if !newError.IsValid() {
|
||||
t.Skip("the contract has no default error response, so the generated server has no NewError")
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user