Giter Club home page Giter Club logo

Comments (11)

benzen avatar benzen commented on September 14, 2024

I've seen your update of the documentation for Cauldron.
So i've updated my usage to:

defmodule Foo do
  # respond to a GET / request with "Hello, World!"
  def handle("GET", %URI{path: "/"}, req) do
    req |> Request.reply(200, "Hello, World!")
  end

end

Now I have this error:

08:49:01.633 [error] Error in process <0.234.0> with exit value: {undef,[{'Elixir.Request',reply,[#{'__struct__'=>'Elixir.Cauldron.HTTP.Request',connection=>#{'__struct__'=>'Elixir.Reagent.Connection',id=>#Ref<0.0.0.1099>,listener=>#{'__struct__'=>'Elixir.Reagent.Listener',acceptors=>#{'__struct__'=>'Elixir.HashSet'...



08:49:01.650 [error] {:undef, [{Request, :reply, [#Cauldron.Request<GET http://127.0.0.1:7792/>, 200, "Hello, World!"], []}]}

08:49:02.037 [error] {:function_clause, [{Foo, :handle, ["GET", %URI{authority: "127.0.0.1:7792", fragment: nil, host: "127.0.0.1", path: "/favicon.ico", port: 7792, query: nil, scheme: "http", userinfo: nil}, #Cauldron.Request<GET http://127.0.0.1:7792/favicon.ico>], [file: 'lib/AntWorld.ex', line: 23]}]}

08:49:02.037 [error] Error in process <0.235.0> with exit value: {function_clause,[{'Elixir.Foo',handle,[<<3 bytes>>,#{'__struct__'=>'Elixir.URI',authority=><<14 bytes>>,fragment=>nil,host=><<9 bytes>>,path=><<12 bytes>>,port=>7792,query=>nil,scheme=><<4 bytes>>,userinfo=>nil},#{'__struct__'=>'Elixir.Cauldron.HTTP.Request',connection=>#{'__struct__'=>'Elixir.Reagent.Connection'...

from httprot.

meh avatar meh commented on September 14, 2024

You're missing use Cauldron.

from httprot.

benzen avatar benzen commented on September 14, 2024

Thanks i've add it now.

But i've got this error now:

10:33:36.082 [error] Error in process <0.254.0> with exit value: {{badmatch,[<<9 bytes>>,<<44 bytes>>,<<1 byte>>]},[{'Elixir.HTTProt.Headers','-from_string/2-lc$^1/1-0-',1,[{file,"lib/httprot/headers.ex"},{line,142}]},{'Elixir.HTTProt.Headers','-from_string/2-lc$^1/1-0-',1,[{file,"lib/httprot/headers.ex"},{line,141}]},{'Elixir.HTTProt.Headers'...

from httprot.

meh avatar meh commented on September 14, 2024

What version of Elixir are you using?

And what browser? Can you paste the headers that are being sent?

from httprot.

benzen avatar benzen commented on September 14, 2024

elixir 1.0.1
browser chrome: 38.0.2125.111

Chrome says it's provisional headers

Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Referer:
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.111 Safari/537.36
X-DevTools-Emulate-Network-Conditions-Client-Id:8D9CD180-5528-E5FE-F28C-20F7271F64D8

Also chrome says it recieve an empty response.

from httprot.

meh avatar meh commented on September 14, 2024

Can you try with another browser please? I'm still unable to reproduce it, just want to know if it's one of those headers you pasted above or if something else is going on.

from httprot.

benzen avatar benzen commented on September 14, 2024

I ll try with curl

Envoyé de mon iPhone

Le 2014-11-11 à 17:29, meh. [email protected] a écrit :

Can you try with another browser please? I'm still unable to reproduce it, just want to know if it's one of those headers you pasted above or if something else is going on.


Reply to this email directly or view it on GitHub.

from httprot.

benzen avatar benzen commented on September 14, 2024

it works just fine.
Maybe by chrome is sending some funky request

from httprot.

benzen avatar benzen commented on September 14, 2024

Oh i know what went wrong.
In my chrome test, I've always used the localhost
But with curl i had an error saying that's it's not lisening on this name.
So i went for 127.0.0.1

On chrome when i switched for the ip, everything whent great.

from httprot.

meh avatar meh commented on September 14, 2024

I think I know.

You probably used the same port for other projects, and there are some cookies registered that httprot is barfing on, now if you could find them and sanitize them from personal information, that would be great.

from httprot.

benzen avatar benzen commented on September 14, 2024

Here it is

Name value
COMPANY_ID 10255
COOKIE_SUPPORT true
GUEST_LANGUAGE_ID fr_FR
ID 52414b4e617e4432484539414273464a2f3968305a773d3d
JSESSIONID F30173812FC6C4A93F24934FA498461C
JSESSIONID AB9EF827DB20D82B0C7E8940B6AE56A5
LFR_SESSION_STATE_10434 expired
SCREEN_NAME 5a4f6b6b34616e31316a6c5634716e78526b335158673d3d
USER_UUID "awPGWlFwQ12XGYgmmAoXxrSy+XAIN+jf4GcRMeo46pQ="
_ga GA1.1.1116705830.1411494152
_your_app_key bHFIS1ppWC85MmRNX0tFMS95ZUpVVjNabVU3V1FMVkNPWjMrbzdGenhBaz0tLXllUEg3T1c2SWNsUkErTEFMS3RLclE9PQ==--/Bgwwalu25d50QePyTGVeDbOgoI=
org.cups.sid 1ef1a3d43a1ab87b711e02b9d39ff532

from httprot.

Related Issues (4)

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.