W3cubDocs

/Angular

HttpUrlEncodingCodec

class final

Provides encoding and decoding of URL parameter and query-string values.

See more...

class HttpUrlEncodingCodec implements HttpParameterCodec {
  encodeKey(key: string): string
  encodeValue(value: string): string
  decodeKey(key: string): string
  decodeValue(value: string)
}

Description

Serializes and parses URL parameter keys and values to encode and decode them. If you pass URL query parameters without encoding, the query parameters can be misinterpreted at the receiving end.

Methods

Encodes a key name for a URL parameter or query-string.

encodeKey(key: string): string

Parameters
key string

The key name.

Returns

string: The encoded key name.

Encodes the value of a URL parameter or query-string.

encodeValue(value: string): string

Parameters
value string

The value.

Returns

string: The encoded value.

Decodes an encoded URL parameter or query-string key.

decodeKey(key: string): string

Parameters
key string

The encoded key name.

Returns

string: The decoded key name.

Decodes an encoded URL parameter or query-string value.

decodeValue(value: string)

Parameters
value string

The encoded value.

© 2010–2023 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://angular.io/api/common/http/HttpUrlEncodingCodec