We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
// file: extensions/0001.go package mock_http_extensions import ( "fmt" "net/http" "time" ) func RequestTransformerFunc(*http.Request) *http.Request { return nil } func ResponseTransformerFunc(*http.Response) *http.Response { return nil } func ResponsePassesValidationFunc(req *http.Request, res *http.Response, tests struct { HTTP *struct { Status *int Headers map[string][]string Body any } Duration *time.Duration }) bool { var isOk bool status := Unwrap[int](tests.HTTP.Status, -100) if status != res.StatusCode { fmt.Printf("ERROR: expected status %v, but got %v\n", status, res.StatusCode) } // TODO: Test body and headers return isOk } func Unwrap[T any](optional *T, d T) T { if optional == nil { return d } return *optional }
# 1 - fatal # 2 - error # 3 - warn # 4 - info # 5 - debug LOG_LEVEL=5 PLUGINS_FILEPATH=./extensions/0001.go
go run . http -o yaml -f ./examples/0001.yaml WARN[0000] Loaded extension: ResponsePassesValidationFunc 0x1044dc5a0 WARN[0000] Loaded extension: RequestTransformerFunc 0x1044dc5a0 WARN[0000] Loaded extension: ResponseTransformerFunc 0x1044dc5a0 DEBU[0000] schema.LoadSchema DEBU[0000] schema.Execute DEBU[0000] schema.Consume DEBU[0000] schema.Send DEBU[0000] schema.(*Request).ParseURL DEBU[0000] schema.(*Request).ParseURL https://api.datamuse.com/words?ml=ocean DEBU[0000] schema.(*Request).HeaderMap DEBU[0001] schema.Send request sent... DEBU[0001] Response for: Datamuse - words related to `ocean` DEBU[0001] schema.(*Request).ParseURL DEBU[0001] schema.(*Request).ParseURL https://api.datamuse.com/words?ml=ocean DEBU[0001] schema.BodyMarshalFunc application/json WARN[0001] Running code for: ResponsePassesValidationFunc WARN[0001] Running tests for: Datamuse - words related to `ocean` ERROR: expected status 400, but got 200
For more details, check out the extensions directory and how it is used in main.go
extensions
main.go
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Extensions file
Env
Execution log
For more details, check out the
extensions
directory and how it is used inmain.go
The text was updated successfully, but these errors were encountered: