Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
fluttertpc_get
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Jason Law
2021-05-23 06:34:41 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d99c1ea9f33116e6e684c5730bf9cd95eb6dbddf
d99c1ea9
1 parent
45a62ed5
GraphQLResponse inherit Response info
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
5 deletions
lib/get_connect/connect.dart
lib/get_connect/http/src/response/response.dart
lib/get_connect/connect.dart
View file @
d99c1ea
...
...
@@ -319,7 +319,7 @@ class GetConnect extends GetConnectInterface {
))
.
toList
());
}
return
GraphQLResponse
<
T
>
(
body:
res
.
body
[
'data'
]
as
T
?
);
return
GraphQLResponse
<
T
>
.
fromResponse
(
res
);
}
on
Exception
catch
(
_
)
{
return
GraphQLResponse
<
T
>(
graphQLErrors:
[
GraphQLError
(
...
...
@@ -355,7 +355,7 @@ class GetConnect extends GetConnectInterface {
))
.
toList
());
}
return
GraphQLResponse
<
T
>
(
body:
res
.
body
[
'data'
]
as
T
?
);
return
GraphQLResponse
<
T
>
.
fromResponse
(
res
);
}
on
Exception
catch
(
_
)
{
return
GraphQLResponse
<
T
>(
graphQLErrors:
[
GraphQLError
(
...
...
lib/get_connect/http/src/response/response.dart
View file @
d99c1ea
...
...
@@ -7,6 +7,16 @@ import '../status/http_status.dart';
class
GraphQLResponse
<
T
>
extends
Response
<
T
>
{
final
List
<
GraphQLError
>?
graphQLErrors
;
GraphQLResponse
({
T
?
body
,
this
.
graphQLErrors
})
:
super
(
body:
body
);
GraphQLResponse
.
fromResponse
(
Response
res
)
:
graphQLErrors
=
null
,
super
(
request:
res
.
request
,
statusCode:
res
.
statusCode
,
bodyBytes:
res
.
bodyBytes
,
bodyString:
res
.
bodyString
,
statusText:
res
.
statusText
,
headers:
res
.
headers
,
body:
res
.
body
[
'data'
]
as
T
?);
}
class
Response
<
T
>
{
...
...
@@ -60,7 +70,8 @@ class Response<T> {
final
T
?
body
;
}
Future
<
String
>
bodyBytesToString
(
Stream
<
List
<
int
>>
bodyBytes
,
Map
<
String
,
String
>
headers
)
{
Future
<
String
>
bodyBytesToString
(
Stream
<
List
<
int
>>
bodyBytes
,
Map
<
String
,
String
>
headers
)
{
return
bodyBytes
.
bytesToString
(
_encodingForHeaders
(
headers
));
}
...
...
@@ -101,7 +112,9 @@ class HeaderValue {
}
static
HeaderValue
parse
(
String
value
,
{
String
parameterSeparator
=
';'
,
String
?
valueSeparator
,
bool
preserveBackslash
=
false
})
{
{
String
parameterSeparator
=
';'
,
String
?
valueSeparator
,
bool
preserveBackslash
=
false
})
{
var
result
=
HeaderValue
();
result
.
_parse
(
value
,
parameterSeparator
,
valueSeparator
,
preserveBackslash
);
return
result
;
...
...
@@ -131,7 +144,8 @@ class HeaderValue {
return
stringBuffer
.
toString
();
}
void
_parse
(
String
value
,
String
parameterSeparator
,
String
?
valueSeparator
,
bool
preserveBackslash
)
{
void
_parse
(
String
value
,
String
parameterSeparator
,
String
?
valueSeparator
,
bool
preserveBackslash
)
{
var
index
=
0
;
bool
done
()
=>
index
==
value
.
length
;
...
...
Please
register
or
login
to post a comment