填写这份《一分钟调查》,帮我们(开发组)做得更好!去填写Home

HttpUrlEncodingCodec

一个 HttpParameterCodec,它使用 encodeURIComponentdecodeURIComponent 来序列化和解析 URL 参数的 key 和 value。 如果你传入未编码的查询参数,那么接收端可能会对这些参数进行错误解析。请使用 HttpParameterCodec 类对查询字符串的值进行编码和解码。

A class that uses encodeURIComponent and decodeURIComponent to serialize and parse URL parameter keys and values. If you pass URL query parameters without encoding, the query parameters can get misinterpreted at the receiving end. Use the HttpParameterCodec class to encode and decode the query-string values.

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

方法

encodeKey(key: string): string
      
      encodeKey(key: string): string
    
参数
key string
返回值

string

encodeValue(value: string): string
      
      encodeValue(value: string): string
    
参数
value string
返回值

string

decodeKey(key: string): string
      
      decodeKey(key: string): string
    
参数
key string
返回值

string

decodeValue(value: string)
      
      decodeValue(value: string)
    
参数
value string