Skip to content
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

Enhance handling of text response - support more text minetypes and subtypes. #1023

Closed

Conversation

tsuga
Copy link

@tsuga tsuga commented Aug 10, 2021

Description

Currently, minetypes starts with "text/" and "application/json" are handled as text responses from the WSGI server.
However, there are more minetypes that should be returned as text, not binary.

This PR adds support for the following minetypes to be treated as text.

  • RFC 4627 (currently supported)
    • application/json
  • RFC 4329 (by this PR)
    • application/javascript
    • application/ecmascript
  • RFC 3023 (by this PR)
    • application/xml
    • application/xml-external-parsed-entity
    • application/xml-dtd
    • image/svg+xml
    • specified by pattern "application/*+xml" including (but not limited to):
      • application/mathml+xml
      • application/xslt+xml
      • application/rdf+xml
      • application/atom+xml (ref: RFC 5023)
      • application/atomcat+xml (ref: RFC 5023)
      • application/atomsvc+xml (ref: RFC 5023)
      • application/beep+xml (ref: RFC 3080)
      • application/rss+xml
      • application/vnd.google-earth.kml+xml
      • application/vnd.irepository.package+xml
      • application/vnd.mozilla.xul+xml
      • application/vnd.pwg-xhtml-print+xml  
      • application/xaml+xml
      • application/xhtml+xml

GitHub Issues

#1021

@tsuga tsuga force-pushed the feature/enhance-handling-of-text-response branch from 2d87d00 to 7ac1c45 Compare September 19, 2021 03:29
@ghostmaster-ai
Copy link

Pease make the same pull request on Zappa2, which is a branch of this repo. Since This repo has been deprecated I will take up maintenance.
PyPi - pip install zappa2

@tsuga
Copy link
Author

tsuga commented Jan 1, 2022

Considering the latest update regarding the maintainers of this project, is this still valid to keep this PR here?

monkut added a commit that referenced this pull request Aug 12, 2022
♻️ define "DEFAULT_TEXT_MIMETYPES" and move to utilities.py
@monkut
Copy link
Collaborator

monkut commented Aug 12, 2022

Integrating partially into:
#1155

closing.

@monkut monkut closed this Aug 12, 2022
monkut added a commit that referenced this pull request Nov 11, 2022
…ata is binary (#1155)

* 🔧 migrate #971 to lastest master

* 🎨 run black/isort

* ♻️ refactor to allow for other binary ignore types based on mimetype. (currently openapi schema can't be passed as text.

* 🎨 run black/fix flake8

* 🔧 add EXCEPTION_HANDLER setting

* 🐛 fix zappa_returndict["body"] assignment

* 📝 add temp debug info

* 🔥 delete unnecessary print statements

* ♻️ Update comments and minor refactor for clarity

* ♻️ refactor for ease of testing and clarity

* 🎨 fix flake8

* ✨ add `additional_text_mimetypes` setting
✅ add testcases for additional_text_mimetypes handling

* 🔧 Expand default text mimetypes mentioned in #1023
♻️ define "DEFAULT_TEXT_MIMETYPES" and move to utilities.py

* 🎨 run black/isort

* 🎨 run black/isort

* 🎨 remove unnecesasry comment (black now reformats code)
🎨 change commented lines to docstring for test app
Ian288 pushed a commit to tackle-io/Zappa that referenced this pull request Jul 11, 2023
… if data is binary (zappa#1155)

* 🔧 migrate zappa#971 to lastest master

* 🎨 run black/isort

* ♻️ refactor to allow for other binary ignore types based on mimetype. (currently openapi schema can't be passed as text.

* 🎨 run black/fix flake8

* 🔧 add EXCEPTION_HANDLER setting

* 🐛 fix zappa_returndict["body"] assignment

* 📝 add temp debug info

* 🔥 delete unnecessary print statements

* ♻️ Update comments and minor refactor for clarity

* ♻️ refactor for ease of testing and clarity

* 🎨 fix flake8

* ✨ add `additional_text_mimetypes` setting
✅ add testcases for additional_text_mimetypes handling

* 🔧 Expand default text mimetypes mentioned in zappa#1023
♻️ define "DEFAULT_TEXT_MIMETYPES" and move to utilities.py

* 🎨 run black/isort

* 🎨 run black/isort

* 🎨 remove unnecesasry comment (black now reformats code)
🎨 change commented lines to docstring for test app
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.

None yet

3 participants