You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2020/03/28 11:38:17 UTC

[GitHub] [couchdb] dottorblaster opened a new issue #2728: HTTPotion became soft-deprecated

dottorblaster opened a new issue #2728: HTTPotion became soft-deprecated
URL: https://github.com/apache/couchdb/issues/2728
 
 
   HTTPotion, the HTTP client we use in our integration test suite, became soft-deprecated. Should we look for an exit strategy?
   
   ## Summary
   
   As of today, doing a `mix deps.get` results in a correct behavior but a warning comes out telling us that HTTPotion is soft-deprecated. 
   
   ## Desired Behaviour
   
   Maybe we don't want that warning, and of course we still want our libraries to be maintained.
   
   ## Possible Solution
   We could use another library as the HTTP client of choice.
   
   Possible choices that I overlooked:
   - [HTTPoison](https://github.com/edgurgel/httpoison) (the basic API looks very similar to HTTPotion's)
   - [Tesla](https://github.com/teamon/tesla)
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [couchdb] iilyak commented on issue #2728: HTTPotion became soft-deprecated

Posted by GitBox <gi...@apache.org>.
iilyak commented on issue #2728: HTTPotion became soft-deprecated
URL: https://github.com/apache/couchdb/issues/2728#issuecomment-605808638
 
 
   Be warned there might be dragons. We are not only using an API of the HTTPotion but override some of the callbacks provided by it (see [here](https://github.com/apache/couchdb/blob/master/test/elixir/lib/couch.ex#L55:L177)).  Things we do:
   
   - prefix the url with the value of `EX_COUCH_URL` environment variable
   - inject authentication cookie into headers
   - automatically encode/decode JSON
   
   In addition to that the `prototype/fdb-layer` branch also allows [passing `base_url` in options](https://github.com/apache/couchdb/blob/prototype/fdb-layer/test/elixir/lib/couch.ex#L171:L174).   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [couchdb] iilyak commented on issue #2728: HTTPotion became soft-deprecated

Posted by GitBox <gi...@apache.org>.
iilyak commented on issue #2728: HTTPotion became soft-deprecated
URL: https://github.com/apache/couchdb/issues/2728#issuecomment-605845068
 
 
   > I'm concerned more about changes_async_test.exs where we heavily use HTTPotion advanced features and I don't know how to replace functions like spawn_worker_process
   
   I think tesla is better option because it supports multiple backends. 
   
   1. We could eliminate `Rawresp` if we would pass additional option to control whether we should try to do JSON decode or not.
   2. The `spawn_worker_process` can be taken from https://github.com/myfreeweb/httpotion/blob/master/lib/httpotion.ex#L17:L25
   ```
         @doc "Starts a worker process for use with the `direct` option."
         def spawn_worker_process(url, options \\ []) do
           GenServer.start(:ibrowse_http_client, url |> process_url(options) |> String.to_charlist, options)
         end
   
         @doc "Starts a linked worker process for use with the `direct` option."
         def spawn_link_worker_process(url, options \\ []) do
           GenServer.start_link(:ibrowse_http_client, url |> process_url(options) |> String.to_charlist, options)
         end
   ```
   3. We need some support for `direct` option. We could do that if we would implement custom ibrowse backend. The current ibrowse backend is around 50 lines https://github.com/teamon/tesla/blob/9ea2e9e663b6ec3ca1acad7178a863b76da0cab9/lib/tesla/adapter/ibrowse.ex.
   We would add `direct` option in opts and implement a dispatch similar to one in HTTPotion (https://github.com/myfreeweb/httpotion/blob/master/lib/httpotion.ex#L242:L246):
   ```
           response = if conn_pid = Keyword.get(options, :direct) do
             :ibrowse.send_req_direct(conn_pid, args[:url], args[:headers], args[:method], args[:body], args[:ib_options], args[:timeout])
           else
             :ibrowse.send_req(args[:url], args[:headers], args[:method], args[:body], args[:ib_options], args[:timeout])
           end
   
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [couchdb] dottorblaster commented on issue #2728: HTTPotion became soft-deprecated

Posted by GitBox <gi...@apache.org>.
dottorblaster commented on issue #2728: HTTPotion became soft-deprecated
URL: https://github.com/apache/couchdb/issues/2728#issuecomment-605836366
 
 
   Thanks for the response @iilyak, yeah we do a couple of things 🙂 but those aren't a problem as this kind of things is fairly common when it comes to these libs. I'm concerned more about `changes_async_test.exs` where we heavily use HTTPotion advanced features and I don't know how to replace functions like `spawn_worker_process`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services