Skip to content

Req.Test fails to handle plug result if into: :self #440

Closed
@mruoss

Description

@mruoss

I try to run the following code:

Req.Test.stub(:foo, fn conn -> Req.Test.text(conn, "okay") end)
Req.get!(base_url: "http://www.example.com", into: :self, plug: {Req.Test, :foo})

This raises the following exception:

** (Protocol.UndefinedError) protocol Collectable not implemented for :self of type Atom. This protocol is implemented for the following type(s): BitString, File.Stream, HashDict, HashSet, IO.Stream, List, Map, MapSet, Mix.Shell, Req.Utils.CollectWithHash
    (elixir 1.17.2) lib/collectable.ex:1: Collectable.impl_for!/1
    (elixir 1.17.2) lib/collectable.ex:92: Collectable.into/1
    (req 0.5.8) lib/req/steps.ex:1046: Req.Steps.handle_plug_result/2
    (req 0.5.8) lib/req/request.ex:1106: Req.Request.run_request/1
    (req 0.5.8) lib/req/request.ex:1050: Req.Request.run/1
    (req 0.5.8) lib/req.ex:1106: Req.request!/2
    #cell:pxciqv2ibo257vwc:3: (file)

Looking at the case stmt in lib/req/steps.ex:1001, :self is really missing. Was this done on purpose?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions