File tree 1 file changed +11
-7
lines changed
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 {
589
589
return nil
590
590
}
591
591
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.
592
598
func PreRequestOptions (opts ... RequestOption ) (RequestConfig , error ) {
593
599
cfg := RequestConfig {}
594
600
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
+ }
602
606
}
603
607
}
604
608
return cfg , nil
You can’t perform that action at this time.
0 commit comments