Package dev.gmitch215.bytebox
Interface Headers
- All Superinterfaces:
org.teavm.jso.JSObject
public interface Headers
extends org.teavm.jso.JSObject
HTTP headers. Names are compared case-insensitively, so
Content-Type and
content-type are the same header.- Since:
- 1.0.0
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdds one header without replacing existing values.voidRemoves a header.Reads one header.default StringReads a header, falling back when absent.org.teavm.jso.core.JSArrayReader<org.teavm.jso.core.JSString> Returns everySet-Cookieseparately, whichget(String)cannot express.booleanReports whether a header is present.voidSets one header, replacing any existing value.Returns everySet-Cookie, as a Java list.Methods inherited from interface org.teavm.jso.JSObject
cast
-
Method Details
-
get
Reads one header.A header sent more than once reads back as its values joined with
", ", which is what the Fetch specification requires.getSetCookie()is the exception, because joining cookies that way corrupts them.- Parameters:
name- the header name- Returns:
- the value, or
nullwhen absent
-
set
Sets one header, replacing any existing value.- Parameters:
name- the header namevalue- the value
-
append
Adds one header without replacing existing values.- Parameters:
name- the header namevalue- the value
-
delete
Removes a header.- Parameters:
name- the header name
-
has
Reports whether a header is present.- Parameters:
name- the header name- Returns:
- whether it is present
-
getSetCookie
org.teavm.jso.core.JSArrayReader<org.teavm.jso.core.JSString> getSetCookie()Returns everySet-Cookieseparately, whichget(String)cannot express.- Returns:
- every
Set-Cookieseparately, whichget(String)cannot express
-
get
Reads a header, falling back when absent.- Parameters:
name- the header namefallback- the value to use when absent- Returns:
- the value, or the fallback
-
setCookies
Returns everySet-Cookie, as a Java list.- Returns:
- every
Set-Cookie, as a Java list
-