Closed lmorandini closed 5 years ago
You can pass all the headers you need via options object. https://github.com/apocas/docker-modem/blob/master/lib/modem.js#L126
I think it's better to only map the official headers (like X-Registry-Auth) and leave "custom" headers to "user land" via options.
Yes, that;s a better alternative However, since the Authorization header (and possibly others) has to be sent with every request, wouldn't it be better to define them when the Modem object is created, and then merge them with the additional headers (if any) passed as argument to "dial"?
In other words: a) adding "this.headers= opts.headers;" to the "Modem" function in "modem.js" b) performing the merge in "dial"
Custom headers implemented in https://github.com/apocas/docker-modem/pull/104
The "auth" property of options is Base64-encoded and added as header "Authorization" to every request. This is necessary when the Docker API is secured by Basic HTTP authentication.