send icon indicating copy to clipboard operation
send copied to clipboard

Extend `format` option to support redirection of trailing slash for directories

Open johnnyxwan opened this issue 5 years ago • 0 comments

Extended format option from ( *true | false ) to ( *'follow' | 'redirect' | false ).

'follow' behaves the same as the old true, and keep as default. 'redirect' is used for the redirection new feature.

If trailing slash for directories is absent and index is defined, when format is set to 'redirect', it redirects the page using HTTP 302 to the URL with trailing slash added, at the same time respecting previous scheme and query.

Return value of await send() is true when such a redirection happened, in contrast of undefined when encountering errors and pathname when the file is served.

johnnyxwan avatar Feb 27 '20 17:02 johnnyxwan