Skip to content

Conversation

@jdotjdot
Copy link

When using django-htmlmin in my project, I found that some responses were being returned without the Content-Type header. Even though I was excluding those URLs from being minified using the settings.py EXCLUDE_FROM_MINIFYING option, the structure of the middleware's can_minify_response function did two things that resulted in errors:

  1. Even after determining via the RegEx check that the URL should be excluded from minification, it continued to perform additional checks that included the error-containing code, and
  2. The check for the Content-Type header in the request dictionary would throw a KeyError if the header wasn't present.

I've fixed both of those issues, as well as adding an additional test in case request._hit_htmlmin is ever set to False (which it shouldn't be, so why not have a test for it?)

@vinitkumar
Copy link

Can we get this merged please?

@vinitkumar
Copy link

Any updates on this, please?

@diegoponciano
Copy link

I'm affected by this issue too, can you merge it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants