mirror of
https://github.com/wanghongenpin/proxypin.git
synced 2026-03-15 04:23:17 +08:00
mediaType default charset
This commit is contained in:
@@ -49,6 +49,8 @@ class MediaType {
|
||||
static List<MediaType> defaultCharsetMediaTypes = [
|
||||
MediaType("text", "plain", charset: "utf-8"),
|
||||
MediaType("text", "html", charset: "utf-8"),
|
||||
MediaType("text", "javascript", charset: "utf-8"),
|
||||
MediaType("text", "css", charset: "utf-8"),
|
||||
MediaType("application", "json", charset: "utf-8"),
|
||||
MediaType("application", "problem+json", charset: "utf-8"),
|
||||
MediaType("application", "xml", charset: "utf-8"),
|
||||
@@ -61,9 +63,10 @@ class MediaType {
|
||||
final String subtype;
|
||||
final Map<String, String> parameters;
|
||||
|
||||
MediaType(this.type, this.subtype, {this.parameters = const {}, String? charset}) {
|
||||
MediaType(this.type, this.subtype, {Map<String, String>? parameters, String? charset})
|
||||
: parameters = parameters ?? {} {
|
||||
if (charset != null) {
|
||||
parameters["charset"] = charset;
|
||||
this.parameters["charset"] = charset;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ abstract class HttpMessage {
|
||||
String? get charset {
|
||||
var contentType = headers.contentType;
|
||||
if (contentType.isEmpty) {
|
||||
return null;
|
||||
return 'utf-8';
|
||||
}
|
||||
|
||||
MediaType mediaType = MediaType.valueOf(contentType);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
pwd
|
||||
cd ../build/linux/x64/release
|
||||
rm -rf package
|
||||
|
||||
Reference in New Issue
Block a user