ContentTypeParam
#struct ContentTypeParamOne parameter.
| Name | Type | Description |
|---|---|---|
key | str = "" | The name, in the case it was sent. |
value | str = "" | The value. |
import net.mime
func main:
println mime.MimeExt("png"), mime.MimeExt("json"), mime.MimeExt(".png")
println mime.MimeType("/site/index.html"), mime.MimeType("style.css")
println mime.StatusText(200), mime.StatusText(404), mime.StatusText(503)
ct := mime.ParseContentType("text/html; charset=UTF-8; q=0.9")
println ct.media_type,
ct.params.items.Len(),
mime.ParamGet(ct, "charset"),
ct.params.items[1].key,
ct.params.items[1].value
endimage/png application/json application/octet-stream text/html; charset=utf-8 text/css OK Not Found Service Unavailable text/html 2 UTF-8 q 0.9