Infers http entity headers from path, entity and existing headers.
If any of the following headers are not given:
content-typeheader is set to the type returned by guess-content-type.
content-lengthis set to the length of the entity buffer.
last-modifiedis set to the current time.
etagis set the MD5 hash of the entity buffer.
Any given headers are left alone. Header names will be transformed to lowercase.
The exported function takes three arguments:
urlcan be an absolute url or just a relative path. Only the path is used.
entityis optional. If it's provided, it must be either a Buffer or a String.
headersis optional too. It signifies the current headers for the entity. Headers which are already set will be left alone. Since all headers are converted to lowercase, input is not case-sensitive.
var inferHeaders =var headers =
headers object contains all existing headers plus any inferred headers.
UTF-8 encoding is assumed for:
Content-Length, if not given.
Content-Typeheader if not is given. If you have anything else than UTF-8 for text-based formats (including html), be sure to set the
infer-entity-headers is released under the MIT License.
Copyright (c) 2013 Meryn Stol