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

mime_from_contenttype(::String)::MIME #8

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

fonsp
Copy link
Member

@fonsp fonsp commented Mar 29, 2022

mime_from_contenttype(content_type::String[, default::T=nothing])::Union{MIME,T}

Extract a MIME from a Content-Type header value. If the input is empty, default is returned.

Examples:

mime_from_contenttype("application/json; charset=utf-8") == MIME"application/json"()
mime_from_contenttype("application/x-bogus") == MIME"application/x-bogus"()
mime_from_contenttype("") == nothing
mime_from_contenttype("", MIME"application/octet-stream"()) == MIME"application/octet-stream"()

@fonsp
Copy link
Member Author

fonsp commented Mar 29, 2022

Tests are not running because of github downtime

@github-actions
Copy link

Try this Pull Request!

Open Julia and type:

julia> import Pkg
julia> Pkg.activate(temp=true)
julia> Pkg.add(url="https://github.com/JuliaWeb/MIMEs.jl", rev="mime_from_contenttype")
julia> using MIMEs

Or run this code in your browser: Run with binder

@NeroBlackstone
Copy link

Any update for this pr?
It's a useful function.

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.

2 participants