Back to packages list

Vals using mime-types

Description from the NPM package:
The ultimate javascript content-type utility.
pomdtr avatar
Augmented run api This val is a wrapper on top of the run api, improving it with additional features: basic auth content-type header in response based on url file extension Usage Custom Content-Type The content-type will be inferred from the filename using the mime-types library. If you use a .html extension, the response will be interpreted as text/html ~ $ curl -v '' HTTP/1.1 200 OK ... Content-Type: text/html; charset=utf-8 ... Hello, World! If you switch the extension to .txt , the content-type header switch to text/raw . ~ $ curl -v '' HTTP/1.1 200 OK ... Content-Type: text/plain; charset=utf-8 ... Hello, World! Passing arguments The request is proxyed to the run api, so you can pass args to your vals via query params or body. See the run api docs for more details. ~ $ curl -X POST -d '{"args": ["pomdtr"]}' '' ... < content-type: text/html; charset=utf-8 ... Hello, pomdtr! Basic Authentication Just add your val town token as the username: curl 'https://<val-token>'