anz-bank / sysl-go

Communication library used by SYSL-generated code written in Go.
Apache License 2.0
10 stars 14 forks source link

Include RestRequestOption interface and OnResult implementation #160

Closed andrewemeryanz closed 4 years ago

andrewemeryanz commented 4 years ago

Custom handler implementations in some instances require access to more information than downstream service calls currently permit. This can include the status code, headers or body in the instance that a non-successful response was returned.

RestRequestOption instances can be passed into downstream REST requests to perform custom actions:

response, err := client.GetRestFooBar(ctx, &request,
    restlib.RestRequestOnResult(func(result *restlib.HTTPResult, err error) {
        // access to raw http result and error
    }))

Closes #105 #159

andrewemeryanz commented 4 years ago

Closing to reopen as draft #160