Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP.request with body::Vector{Any} throws an exception #895

Closed
eduartos opened this issue Jul 26, 2022 · 3 comments
Closed

HTTP.request with body::Vector{Any} throws an exception #895

eduartos opened this issue Jul 26, 2022 · 3 comments

Comments

@eduartos
Copy link

Versions

  • Julia 1.7.3
  • HTTP.jl 1.2.0

Sending a request with body = Vector{Any}() throws an exception:

Jul 26 13:29:02: ┌ Error: unhandled exception
Jul 26 13:29:02: │   exception =
Jul 26 13:29:02: │    MethodError: no method matching ismarked(::Vector{Any})
Jul 26 13:29:02: │    Closest candidates are:
Jul 26 13:29:02: │      ismarked(!Matched::Base.AbstractPipe) at io.jl:380
Jul 26 13:29:02: │      ismarked(!Matched::Base.LibuvStream) at stream.jl:1268
Jul 26 13:29:02: │      ismarked(!Matched::TranscodingStreams.TranscodingStream) at /root/.julia/packages/TranscodingStreams/IVlnc/src/stream.jl:202
Jul 26 13:29:02: │      ...
Jul 26 13:29:02: │   stack =
Jul 26 13:29:02: │    50-element Vector{Base.StackTraces.StackFrame}:
Jul 26 13:29:02: │     retryable(r::HTTP.Messages.Request) at Messages.jl:264
Jul 26 13:29:02: │     (::HTTP.RetryRequest.var"#3#6"{Int64, HTTP.Messages.Request, Base.RefValue{Int64}})(s::Tuple{Int64, Float64}, ex::HTTP.Exceptions.RequestError) at RetryRequest.jl:42
Jul 26 13:29:02: │     ⋮
@eduartos eduartos changed the title HTTP.request with body::Vector{UInt8} throws an exception HTTP.request with body::Vector{Any} throws an exception Jul 26, 2022
@stelmo
Copy link

stelmo commented Aug 3, 2022

I also get a similar error. Here is a MWE (I need to run it twice to get the error):

body = 
  """
      PREFIX rh: <http://rdf.rhea-db.org/>
      PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
      SELECT ?verb ?obj 
      WHERE {
        rh:11844 ?verb ?obj .
      }
  """
r = HTTP.request(
    "POST",
    endpoint_url,
    [
        "Accept" => "application/sparql-results+json",
        "Content-type" => "application/x-www-form-urlencoded",
    ],
    Dict("query" => body),
)

with error:

julia> r = HTTP.request(                                                                                                                                                       
           "POST",                                                                                                                                                             
           endpoint_url,                                                                                                                                                       
           [                                                                                                                                                                   
               "Accept" => "application/sparql-results+json",                                                                                                                  
               "Content-type" => "application/x-www-form-urlencoded",                                                                                                          
                   ],                                                                                                                                                          
           Dict("query" => body),                                                                                                                                              
           )
ERROR: MethodError: no method matching ismarked(::Dict{String, String})
Closest candidates are:
  ismarked(::Base.AbstractPipe) at io.jl:427
  ismarked(::Base.LibuvStream) at stream.jl:1458
  ismarked(::TranscodingStreams.TranscodingStream) at C:\Users\stelmo\.julia\packages\TranscodingStreams\IVlnc\src\stream.jl:202
  ...

I am in Julia v1.8.0-rc3 and HTTP v1.2.0.

quinnj added a commit that referenced this issue Aug 16, 2022
I've accumulated some of these while updating packages around the
ecosystem. They include:
  * Fix for #895
  * Allow forcing decompression by passing `decompress=true`,
    this can be handy when you want to decompress, but you don't
    get the `Content-Encoding` header back
  * In our `@client` macro, allowing `open` form request as well
quinnj added a commit that referenced this issue Aug 16, 2022
I've accumulated some of these while updating packages around the
ecosystem. They include:
  * Fix for #895
  * Allow forcing decompression by passing `decompress=true`,
    this can be handy when you want to decompress, but you don't
    get the `Content-Encoding` header back
  * In our `@client` macro, allowing `open` form request as well
@quinnj
Copy link
Member

quinnj commented Aug 16, 2022

Fixed in #904

@quinnj quinnj closed this as completed Aug 16, 2022
@stelmo
Copy link

stelmo commented Aug 16, 2022

Thank you very much!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants