celluloid / reel-rack

UNMAINTAINED: See celluloid/celluloid#779
https://celluloid.io
MIT License
51 stars 24 forks source link

construct full url to pass to MockRequest#env_for #15

Open challengee opened 10 years ago

challengee commented 10 years ago

I came accross issue #5 while testing reel with rack urlmap. It's not working because SERVER_NAME and SERVER_PORT do not get set correctly (see https://github.com/rack/rack/blob/master/lib/rack/mock.rb#L88).

I modified this so that a more complete url is passed to env_for. I don't know if it's the right way to go.

What do you think?

tarcieri commented 10 years ago

It's probably fine you're not handling the scheme, as reel-rack presently doesn't provide HTTPS support. It should! But that doesn't block this patch.

What happens if request.headers['Host'] is empty?