(mapping, parent)
| 163 | } |
| 164 | |
| 165 | function assignDefaults(mapping, parent) { |
| 166 | const rawHeaders = Object.assign({}, defaults.headers, mapping.headers) |
| 167 | const headers = {} |
| 168 | for (let key in rawHeaders) { |
| 169 | // Discard headers with falsy values |
| 170 | if (rawHeaders.hasOwnProperty(key) && rawHeaders[key]) { |
| 171 | // Get the value now if the header is specified as a function |
| 172 | const headerValue = typeof rawHeaders[key] == 'function' ? rawHeaders[key]() : rawHeaders[key] |
| 173 | headers[key] = headerValue |
| 174 | } |
| 175 | } |
| 176 | |
| 177 | return Object.assign( |
| 178 | { |
| 179 | meta: {} |
| 180 | }, |
| 181 | defaults, |
| 182 | parent ? { |
| 183 | fetch: parent.fetch, |
| 184 | buildRequest: parent.buildRequest, |
| 185 | handleResponse: parent.handleResponse, |
| 186 | Request: parent.Request, |
| 187 | comparison: parent.comparison, |
| 188 | then: undefined, |
| 189 | andThen: undefined |
| 190 | } : {}, |
| 191 | mapping, |
| 192 | { headers } |
| 193 | ) |
| 194 | } |
| 195 | |
| 196 | return function wrapWithConnect(WrappedComponent) { |
| 197 | class RefetchConnect extends Component { |
no outgoing calls
no test coverage detected
searching dependent graphs…