mirror of
https://github.com/foss42/apidash.git
synced 2025-12-02 10:49:49 +08:00
Bug fix curl_parser
This commit is contained in:
@@ -130,10 +130,15 @@ class Curl extends Equatable {
|
||||
headers = <String, String>{};
|
||||
for (var headerString in headersList) {
|
||||
final splittedHeaderString = headerString.split(RegExp(r':\s*'));
|
||||
if (splittedHeaderString.length != 2) {
|
||||
if (splittedHeaderString.length > 2) {
|
||||
headers.addAll({
|
||||
splittedHeaderString[0]: splittedHeaderString.sublist(1).join(":")
|
||||
});
|
||||
} else if (splittedHeaderString.length < 2) {
|
||||
throw Exception('Failed to split the `$headerString` header');
|
||||
} else {
|
||||
headers.addAll({splittedHeaderString[0]: splittedHeaderString[1]});
|
||||
}
|
||||
headers.addAll({splittedHeaderString[0]: splittedHeaderString[1]});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user