-
Notifications
You must be signed in to change notification settings - Fork 114
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
Rl feature/support ignore request #131
Rl feature/support ignore request #131
Conversation
syntax changes Add to Unreleased CHANGELOG
Co-authored-by: Andrew Bromwich <[email protected]>
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.
Change looks good @braindeaf 👍
A few minor issues with the specs though. Let me know if you need any more info
spec/grover/middleware_spec.rb
Outdated
response = get 'http://www.example.org/foobarbar', {}, { 'X-BLOCK' => '1' } | ||
expect(response.content_type).to eq 'text/html' | ||
|
||
response = get 'http://www.therealexample.org/foobarbar.pdf' |
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.
ideally this should match the request on L890 (aside from the "block" header) so as to minimise the things changing between success and failure.
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.
OK, I think I got you.
- blocking with host (html request) returns html
2.blocking with host (pdf request) returns html - not blocking with host (html request) returns html
- not blocking with host (pdf request) returns pdf
spec/grover/middleware_spec.rb
Outdated
response = get 'http://www.example.org/foobazbar.pdf', {}, { 'X-BLOCK' => '1' } | ||
expect(response.content_type).to eq 'text/html' | ||
|
||
response = get 'http://www.example.org/foobarbar', {}, { 'X-BLOCK' => '1' } |
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.
not sure what this is adding to the tests? Ideally this and the next test would both NOT have the extra header. And I would suggest that the URI requested be the same for all (except for the .pdf
extension where appropriate!)
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.
OK, I think I got you.
- blocking with header (html request) returns html
- blocking with header (pdf request) returns html
- not blocking with header (html request) returns html
- not blocking with header (pdf request) returns pdf
spec/grover/middleware_spec.rb
Outdated
response = get 'http://www.example.org/foobarbar' | ||
expect(response.content_type).to eq 'text/html' | ||
|
||
response = get 'http://www.therealexample.org/foobarbar.pdf' |
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.
same applies to these tests. The first two are www.example.org
, the second two should be something different (not just this one). And I would also suggest that the path (except the extension where appropriate) should be the same. ie foobazbar[.pdf]
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.
OK, I think I got you.
- blocking with host (html request) returns html
- blocking with host (pdf request) returns html
- not blocking with host (html request) returns html
- not blocking with host (pdf request) returns pdf
README.md
Outdated
@@ -270,8 +270,7 @@ N.B. by default PNG and JPEG are not modified in the middleware to prevent break | |||
To enable them, there are configuration options for each image type as well as an option to disable the PDF middleware | |||
(on by default). | |||
|
|||
If either of the image handling middleware options are enabled, the [ignore_path](#ignore_path) should also | |||
be configured, otherwise assets are likely to be handled which would likely result in 404 responses. | |||
If either of the image handling middleware options are enabled, the [ignore_path](#ignore_path) and/or [ignore_request](#ignore_request) should also be configured, otherwise assets are likely to be handled which would likely result in 404 responses. |
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.
Can you please split these over multiple lines. Although it doesn't make a difference for the rendered markdown, it's easier to read in most editors if the line length is kept under 120.
If either of the image handling middleware options are enabled, the [ignore_path](#ignore_path) and/or [ignore_request](#ignore_request) should also be configured, otherwise assets are likely to be handled which would likely result in 404 responses. | |
If either of the image handling middleware options are enabled, the [ignore_path](#ignore_path) and/or | |
[ignore_request](#ignore_request) should also be configured, otherwise assets are likely to be handled | |
which would likely result in 404 responses. |
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.
Done
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.
Looks like your specs were still changing multiple things. You should always try to just change one thing and see that the change has the desired outcome
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.
Thanks @braindeaf 👍
FYI it looks like the recent Let's Encrypt certificate expiry is affecting the build system. I've got another PR in the works that should fix that (#132) |
Excellent, thank you :) |
Released in v1.0.6 |
Came across a requirement today to ignore_request? based on the actual request. Sometimes path alone is not enough. This allows testing of the Rack::Request.