Add some HTTP header constants (#10127)

Motivation:

Add some missing HTTP header names and values constants.

Modification:

* names:
  * dnt (Do Not Track)
  * upgrade-insecure-requests
  * x-requested-with
* values:
  * application/xhtml+xml
  * application/xml
  * text/css
  * text/html
  * text/event-stream
  * XmlHttpRequest

Result:

More constants available
This commit is contained in:
Stephane Landelle 2020-03-23 13:05:58 +01:00 committed by GitHub
parent 99aca1879f
commit fcf7144f7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 0 deletions

View File

@ -160,6 +160,10 @@ public final class HttpHeaderNames {
* {@code "date"}
*/
public static final AsciiString DATE = AsciiString.cached("date");
/**
* {@code "dnt"}
*/
public static final AsciiString DNT = AsciiString.cached("dnt");
/**
* {@code "etag"}
*/
@ -318,6 +322,10 @@ public final class HttpHeaderNames {
* {@code "upgrade"}
*/
public static final AsciiString UPGRADE = AsciiString.cached("upgrade");
/**
* {@code "upgrade-insecure-requests"}
*/
public static final AsciiString UPGRADE_INSECURE_REQUESTS = AsciiString.cached("upgrade-insecure-requests");
/**
* {@code "user-agent"}
*/
@ -354,6 +362,10 @@ public final class HttpHeaderNames {
* {@code "x-frame-options"}
*/
public static final AsciiString X_FRAME_OPTIONS = AsciiString.cached("x-frame-options");
/**
* {@code "x-requested-with"}
*/
public static final AsciiString X_REQUESTED_WITH = AsciiString.cached("x-requested-with");
private HttpHeaderNames() { }
}

View File

@ -35,6 +35,14 @@ public final class HttpHeaderValues {
* {@code "application/octet-stream"}
*/
public static final AsciiString APPLICATION_OCTET_STREAM = AsciiString.cached("application/octet-stream");
/**
* {@code "application/xhtml+xml"}
*/
public static final AsciiString APPLICATION_XHTML = AsciiString.cached("application/xhtml+xml");
/**
* {@code "application/xml"}
*/
public static final AsciiString APPLICATION_XML = AsciiString.cached("application/xml");
/**
* {@code "attachment"}
* See {@link HttpHeaderNames#CONTENT_DISPOSITION}
@ -192,6 +200,18 @@ public final class HttpHeaderValues {
* {@code "s-maxage"}
*/
public static final AsciiString S_MAXAGE = AsciiString.cached("s-maxage");
/**
* {@code "text/css"}
*/
public static final AsciiString TEXT_CSS = AsciiString.cached("text/css");
/**
* {@code "text/html"}
*/
public static final AsciiString TEXT_HTML = AsciiString.cached("text/html");
/**
* {@code "text/event-stream"}
*/
public static final AsciiString TEXT_EVENT_STREAM = AsciiString.cached("text/event-stream");
/**
* {@code "text/plain"}
*/
@ -208,6 +228,10 @@ public final class HttpHeaderValues {
* {@code "websocket"}
*/
public static final AsciiString WEBSOCKET = AsciiString.cached("websocket");
/**
* {@code "websocket"}
*/
public static final AsciiString XML_HTTP_REQUEST = AsciiString.cached("XmlHttpRequest");
private HttpHeaderValues() { }
}