-
Notifications
You must be signed in to change notification settings - Fork 178
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
Render the console inside the body tag #162
Conversation
@gsamokovarov: no appropriate reviewer found, use r? to override |
# possible. | ||
# | ||
# The object quacks like Rack::Response. | ||
class Response < Struct.new(:body, :status, :headers) | ||
# Returns whether the response is from an acceptable content type. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to remove this comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Yeah, I will do. |
6401a95
to
1314979
Compare
@sh19910711 I've updated the PR. |
assert_select 'body > #console' | ||
end | ||
|
||
test '#acceptable_content_type? is truthy if response format is HTML' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test case seems to be doing the same thing as the above one (test 'render console inside the body tag'
). We can merge them into one, perhaps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup.
The code seems good to me.
I like that 👍 |
1314979
to
c8f87c6
Compare
Before this commit, the console was rendered straight after the closing </html> tag, which made the page HTML invalid. However, browsers are used to be molested and they are really good at displaying whatever you throw at them, so that wasn't big problem anyway. Still it was something that bug me quite a bit. I'm trying to redeem myself here. Because I had to change the newly introduce `WebConsole::Response` class I had cleaned the workspace a bit: * `WebConsole::Response` no longer depends on a logger. The detection should be better now, so we don't need to couple the query check in it. * `WebConsole::Response` does one thing only. It used to check the acceptance of a given `Content-Type`. I moved this to the middleware class. * I have reverted the `WebConsole::WhinyRequest` to keep the logging out of the logic in the request class. We no longer need to log in two separate classes, so no need to break `Liskov` or introduce logging into simple query methods.
c8f87c6
to
a7b28cc
Compare
Render the console inside the body tag
Before this commit, the console was rendered straight after the closing
tag, which made the page HTML invalid. However, browsers are used to be molested and they are really good at displaying whatever you throw at them, so that wasn't big problem anyway. Still it was something that bug me quite a bit. I'm trying to redeem myself here.Because I had to change the newly introduced
WebConsole::Response
classI had cleaned the workspace a bit:
WebConsole::Response
no longer depends on a logger. The detectionshould be better now, so we don't need to couple the query check in
it.
WebConsole::Response
does one thing only. It used to check theacceptance of a given
Content-Type
. I moved this to the middlewareclass.
WebConsole::WhinyRequest
to keep the logging outof the logic in the request class. We no longer need to log in two
separate classes, so no need to break
Liskov
or introduce logginginto simple query methods.
@sh19910711 do you wanna review this?