File returns the file associated with the given name. If no name was provided during addition, it attempts to match by the file's base name.
(name string)
| 534 | // File returns the file associated with the given name. |
| 535 | // If no name was provided during addition, it attempts to match by the file's base name. |
| 536 | func (r *Request) File(name string) *File { |
| 537 | for _, v := range r.files { |
| 538 | switch v.name { |
| 539 | case "": |
| 540 | if filepath.Base(v.path) == name { |
| 541 | return v |
| 542 | } |
| 543 | case name: |
| 544 | return v |
| 545 | default: |
| 546 | continue |
| 547 | } |
| 548 | } |
| 549 | return nil |
| 550 | } |
| 551 | |
| 552 | // Files returns all files added to the Request. |
| 553 | // |
no outgoing calls