This is the accepts class. With this class you can check if the client accepts certain content types, encodings, charsets and/or languages.
With this function you can get or check what charsets are accepted. If the type parameter is undefined it will return all the accepted charsets. You can also insert an array of charsets and the first item that is accepted will be returned.
// with as content-type "utf-8"
req.charset(["ascii", "utf-8", "utf-16"]);
// -> will return "utf-8"
With this function you can get or check what encodings are accepted. If the type parameter is undefined it will return all the accepted encodings. You can also insert an array of encodings and the first item that is accepted will be returned.
// with as content-type "deflate"
req.charset(["utf-8", "deflate", "gzip"]);
// -> will return "deflate"
With this function you can get or check what languages are accepted. If the type parameter is undefined it will return all the accepted languages. You can also insert an array of languages and the first item that is accepted will be returned.
// with as content-type "en"
req.charset(["nl", "en", "de"]);
// -> will return "en"
With this function you can get or check what types are accepted. If the type parameter is undefined it will return all the accepted types. You can also insert an array of types and the first item that is accepted will be returned.
// with as content-type "application/javascript"
req.charset(["css", "js", "html"]);
// -> will return "application/javascript"