DefaultTransport returns the default transport for the given server. If multiple transports are defined, HTTP transport is used as the default.
()
| 149 | // DefaultTransport returns the default transport for the given server. |
| 150 | // If multiple transports are defined, HTTP transport is used as the default. |
| 151 | func (s *Data) DefaultTransport() *TransportData { |
| 152 | if len(s.Transports) == 1 { |
| 153 | return s.Transports[0] |
| 154 | } |
| 155 | for _, t := range s.Transports { |
| 156 | if t.Type == TransportHTTP { |
| 157 | return t |
| 158 | } |
| 159 | } |
| 160 | return nil // bug |
| 161 | } |
| 162 | |
| 163 | // HasTransport checks if the server supports the given transport. |
| 164 | func (s *Data) HasTransport(transport Transport) bool { |
no outgoing calls
no test coverage detected