File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed
Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -589,16 +589,20 @@ func (cfg *RequestConfig) Apply(opts ...RequestOption) error {
589589 return nil
590590}
591591
592+ // PreRequestOptions is used to collect all the options which need to be known before
593+ // a call to [RequestConfig.ExecuteNewRequest], such as path parameters
594+ // or global defaults.
595+ // PreRequestOptions will return a [RequestConfig] with the options applied.
596+ //
597+ // Only request option functions of type [PreRequestOptionFunc] are applied.
592598func PreRequestOptions (opts ... RequestOption ) (RequestConfig , error ) {
593599 cfg := RequestConfig {}
594600 for _ , opt := range opts {
595- if _ , ok := opt .(PreRequestOptionFunc ); ! ok {
596- continue
597- }
598-
599- err := opt .Apply (& cfg )
600- if err != nil {
601- return cfg , err
601+ if opt , ok := opt .(PreRequestOptionFunc ); ok {
602+ err := opt .Apply (& cfg )
603+ if err != nil {
604+ return cfg , err
605+ }
602606 }
603607 }
604608 return cfg , nil
You can’t perform that action at this time.
0 commit comments