HttpParams
class
npm Package | @angular/common |
---|---|
Module | import { HttpParams } from '@angular/common/http'; |
Source | common/http/src/params.ts |
Overview
class HttpParams { constructor(options: {...}) has(param: string): boolean get(param: string): string|null getAll(param: string): string[]|null keys(): string[] append(param: string, value: string): HttpParams set(param: string, value: string): HttpParams delete(param: string, value?: string): HttpParams toString(): string }
Description
An HTTP request/response body that represents serialized parameters, per the MIME type application/x-www-form-urlencoded
.
This class is immuatable - all mutation operations return a new instance.
Constructor
constructor(options: {
fromString?: string,
encoder?: HttpParameterCodec,
} = {})
Members
has(param: string): boolean
Check whether the body has one or more values for the given parameter name.
get(param: string): string|null
Get the first value for the given parameter name, or null
if it's not present.
getAll(param: string): string[]|null
Get all values for the given parameter name, or null
if it's not present.
keys(): string[]
Get all the parameter names for this body.
append(param: string, value: string): HttpParams
Construct a new body with an appended value for the given parameter name.
set(param: string, value: string): HttpParams
Construct a new body with a new value for the given parameter name.
delete(param: string, value?: string): HttpParams
Construct a new body with either the given value for the given parameter removed, if a value is given, or all values for the given parameter removed if not.
toString(): string
Serialize the body to an encoded string, where key-value pairs (separated by =
) are separated by &
s.
© 2010–2017 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v4.angular.io/api/common/http/HttpParams