How do you URL encode parameters in Erlang?

前端 未结 8 1115
清歌不尽
清歌不尽 2020-12-31 01:17

I\'m using httpc:request to post some data to a remote service. I have the post working but the data in the body() of the post comes through as is, without any URL-encoding

8条回答
  •  温柔的废话
    2020-12-31 01:48

    To answer my own question...I found this lib in ibrowse!

    http://www.erlware.org/lib/5.6.3/ibrowse-1.4/ibrowse_lib.html#url_encode-1

    url_encode/1
    
    url_encode(Str) -> UrlEncodedStr
    
    Str = string()
    UrlEncodedStr = string()
    

    URL-encodes a string based on RFC 1738. Returns a flat list.

    I guess I can use this to do the encoding and still use http:

提交回复
热议问题