Code Monkey home page Code Monkey logo

Comments (6)

ins429 avatar ins429 commented on July 24, 2024 1

@parroty hey I think this sanitizing option fix needs to be applied to ibrowser adapter(and maybe to all adapters), https://github.com/parroty/exvcr/blob/master/lib/exvcr/adapter/ibrowse/converter.ex#L52.
Had the same error without using the hackney adapter which my request also doing the basic_auth.

from exvcr.

parroty avatar parroty commented on July 24, 2024

Thanks for the report.
It seems failing to encode the information as json, and I would like to check what is being received.
Is there any way that I can access to your code, or request/response information you're sending with your code?

from exvcr.

taylorbrooks avatar taylorbrooks commented on July 24, 2024
defmodule ExCloseioTest do                                                                                
  use ExUnit.Case                                                                                         
  use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney                                                          

  setup_all do                                                                                            
    ExVCR.Config.cassette_library_dir("fixture/vcr_cassettes", "fixture/custom_cassettes")                                         
    HTTPoison.start                                                                                       
    :ok                                                                                                   
  end                                                                                                     

  test "fetch lead" do                                                                                    
    api_key = System.get_env("CLOSEIO_API_KEY")
    id      = "lead_lw2TrH5eMLnFz70UdF6f8zx3ElL6cPM0MHkgu4IzTFQ"                                          
    path    = "https://app.close.io/api/v1/lead/#{id}/"                                                      
    auth    = [hackney: [basic_auth: {api_key, ""}]]                                                         

    use_cassette "fetch_lead" do                                                                           
      lead = HTTPoison.get!(path, [], auth)                                                               
      assert lead.id, id                                                                                  
    end                                                                                                   
  end                                                                                                     
end                                   

If I do IO.inspect(lead), lead is an HTTPoison.Response struct, with the top level keys being:

  • status_code
  • body
  • headers

from exvcr.

parroty avatar parroty commented on July 24, 2024

Thanks for the information, I could reproduce the error.

It seems the encoding tuples in basic_auth option is causing the error. I'm not confident how it should be fixed yet, but I'm trying to avoid the error in the above commit (4906359) in the issue_30 branch.

Is it possible for you to retry with the code in the branch? Specifying the branch name in the mix.exs like the following would use the code.

{:exvcr, github: "parroty/exvcr", branch: "issue_30", only: :test},

from exvcr.

taylorbrooks avatar taylorbrooks commented on July 24, 2024

Yep, that worked.

from exvcr.

parroty avatar parroty commented on July 24, 2024

Thanks! pushed as v0.5.2.

from exvcr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.