vary

WebJar for vary

Лицензия

Лицензия

MIT
Группа

Группа

org.webjars.bowergithub.jshttp
Идентификатор

Идентификатор

vary
Последняя версия

Последняя версия

1.1.2
Дата

Дата

Тип

Тип

jar
Описание

Описание

vary
WebJar for vary
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/jshttp/vary

Скачать vary

Имя Файла Размер
vary-1.1.2.pom
vary-1.1.2.jar 10 KB
vary-1.1.2-sources.jar 22 bytes
vary-1.1.2-javadoc.jar 22 bytes
Обзор

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.bowergithub.jshttp/vary/ -->
<dependency>
    <groupId>org.webjars.bowergithub.jshttp</groupId>
    <artifactId>vary</artifactId>
    <version>1.1.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.bowergithub.jshttp/vary/
implementation 'org.webjars.bowergithub.jshttp:vary:1.1.2'
// https://jarcasting.com/artifacts/org.webjars.bowergithub.jshttp/vary/
implementation ("org.webjars.bowergithub.jshttp:vary:1.1.2")
'org.webjars.bowergithub.jshttp:vary:jar:1.1.2'
<dependency org="org.webjars.bowergithub.jshttp" name="vary" rev="1.1.2">
  <artifact name="vary" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.bowergithub.jshttp', module='vary', version='1.1.2')
)
libraryDependencies += "org.webjars.bowergithub.jshttp" % "vary" % "1.1.2"
[org.webjars.bowergithub.jshttp/vary "1.1.2"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

vary

NPM Version NPM Downloads Node.js Version Build Status Test Coverage

Manipulate the HTTP Vary header

Installation

This is a Node.js module available through the npm registry. Installation is done using the npm install command:

$ npm install vary

API

var vary = require('vary')

vary(res, field)

Adds the given header field to the Vary response header of res. This can be a string of a single field, a string of a valid Vary header, or an array of multiple fields.

This will append the header if not already listed, otherwise leaves it listed in the current location.

// Append "Origin" to the Vary header of the response
vary(res, 'Origin')

vary.append(header, field)

Adds the given header field to the Vary response header string header. This can be a string of a single field, a string of a valid Vary header, or an array of multiple fields.

This will append the header if not already listed, otherwise leaves it listed in the current location. The new header string is returned.

// Get header string appending "Origin" to "Accept, User-Agent"
vary.append('Accept, User-Agent', 'Origin')

Examples

Updating the Vary header when content is based on it

var http = require('http')
var vary = require('vary')

http.createServer(function onRequest (req, res) {
  // about to user-agent sniff
  vary(res, 'User-Agent')

  var ua = req.headers['user-agent'] || ''
  var isMobile = /mobi|android|touch|mini/i.test(ua)

  // serve site, depending on isMobile
  res.setHeader('Content-Type', 'text/html')
  res.end('You are (probably) ' + (isMobile ? '' : 'not ') + 'a mobile user')
})

Testing

$ npm test

License

MIT

org.webjars.bowergithub.jshttp
Low-Level JavaScript HTTP-related Modules

Версии библиотеки

Версия
1.1.2