Hi! After updating the library I'm getting this issue. I suppose is related to the JSON2 to JSON update
┌ Error: error handling request
│ exception =
│ Unexpected end of input
│ Line: 0
│ Around: ......
│ ^
│
│ Stacktrace:
│ [1] _error(::String, ::JSON.Parser.MemoryParserState) at /home/luciano/.julia/packages/JSON/d89fA/src/Parser.jl:142
│ [2] byteat at /home/luciano/.julia/packages/JSON/d89fA/src/Parser.jl:51 [inlined]
│ [3] parse_value(::JSON.Parser.ParserContext{Dict{String,Any},Int64,true,nothing}, ::JSON.Parser.MemoryParserState) at /home/luciano/.julia/packages/JSON/d89fA/src/Parser.jl:162
│ [4] #parse#1(::Type, ::Type{Int64}, ::Bool, ::Nothing, ::typeof(JSON.Parser.parse), ::String) at /home/luciano/.julia/packages/JSON/d89fA/src/Parser.jl:463
│ [5] parse at /home/luciano/.julia/packages/JSON/d89fA/src/Parser.jl:461 [inlined]
│ [6] parse(::Type{Bukdu.Plug.ContentParsers.MergedJSON}, ::Base.GenericIOBuffer{Array{UInt8,1}}) at /home/luciano/.julia/dev/Bukdu/src/plugs/ContentParsers.jl:129
│ [7] fetch_body_params(::HTTP.Messages.Request) at /home/luciano/.julia/dev/Bukdu/src/plugs/ContentParsers.jl:140
│ [8] handle_request(::HTTP.Messages.Request, ::HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}) at /home/luciano/.julia/dev/Bukdu/src/server.jl:7
│ [9] handle_stream(::HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}}) at /home/luciano/.julia/dev/Bukdu/src/server.jl:39
│ [10] macro expansion at /home/luciano/.julia/packages/HTTP/lZVI1/src/Servers.jl:360 [inlined]
│ [11] (::HTTP.Servers.var"#13#14"{typeof(Bukdu.handle_stream),HTTP.ConnectionPool.Transaction{Sockets.TCPSocket},HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}}})() at ./task.jl:333
I think is the error arise here when read(buf, String) is empty.
I solved for now doing something like this
function parse(::Type{MergedJSON}, buf::IOBuffer)::Vector{Pair{String,Any}}
str = read(buf, String)
if isempty(str)
return []
end
nt = JSON.parse(str)
return [Pair(string(k),v) for (k,v) in pairs(nt)]
end
But I'm not sure if the right way to handle it
Hi! After updating the library I'm getting this issue. I suppose is related to the JSON2 to JSON update
I think is the error arise here when
read(buf, String)is empty.I solved for now doing something like this
But I'm not sure if the right way to handle it