Skip to content

Commit f67adee

Browse files
committed
Append options to default request options instead of doing two loops
as requested in review
1 parent 6efa54d commit f67adee

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

gitlab.go

+2-18
Original file line numberDiff line numberDiff line change
@@ -598,15 +598,7 @@ func (c *Client) NewRequest(method, path string, opt interface{}, options []Requ
598598
return nil, err
599599
}
600600

601-
for _, fn := range c.defaultRequestOptions {
602-
if fn == nil {
603-
continue
604-
}
605-
if err := fn(req); err != nil {
606-
return nil, err
607-
}
608-
}
609-
for _, fn := range options {
601+
for _, fn := range append(c.defaultRequestOptions, options...) {
610602
if fn == nil {
611603
continue
612604
}
@@ -682,15 +674,7 @@ func (c *Client) UploadRequest(method, path string, content io.Reader, filename
682674
return nil, err
683675
}
684676

685-
for _, fn := range c.defaultRequestOptions {
686-
if fn == nil {
687-
continue
688-
}
689-
if err := fn(req); err != nil {
690-
return nil, err
691-
}
692-
}
693-
for _, fn := range options {
677+
for _, fn := range append(c.defaultRequestOptions, options...) {
694678
if fn == nil {
695679
continue
696680
}

0 commit comments

Comments
 (0)