@@ -33,11 +33,11 @@ public Task<MojangAPIResponse> CheckTrusted(string accessToken) =>
33
33
34
34
RequestHeaders = new HttpHeaderCollection
35
35
{
36
- { "Authorization" , "Bearer " + accessToken ?? throw new ArgumentNullException ( ) }
36
+ { "Authorization" , "Bearer " + accessToken ?? throw new ArgumentNullException ( nameof ( accessToken ) ) }
37
37
} ,
38
38
39
39
ResponseHandler = HttpResponseHandlers . GetSuccessCodeResponseHandler ( new MojangAPIResponse ( ) ) ,
40
- ErrorHandler = null
40
+ ErrorHandler = HttpResponseHandlers . GetJsonErrorHandler < MojangAPIResponse > ( )
41
41
} ) ;
42
42
43
43
public Task < QuestionFlowResponse > GetQuestionList ( string accessToken ) =>
@@ -68,7 +68,7 @@ public Task<QuestionFlowResponse> GetQuestionList(string accessToken) =>
68
68
69
69
return new QuestionFlowResponse ( new QuestionList ( questions . ToArray ( ) ) ) ;
70
70
} ,
71
- ErrorHandler = null
71
+ ErrorHandler = HttpResponseHandlers . GetJsonErrorHandler < QuestionFlowResponse > ( )
72
72
} ) ;
73
73
74
74
public Task < MojangAPIResponse > SendAnswers ( QuestionList list , string accessToken )
@@ -85,11 +85,11 @@ public Task<MojangAPIResponse> SendAnswers(QuestionList list, string accessToken
85
85
JArray jarr = new JArray ( ) ;
86
86
foreach ( var item in list )
87
87
{
88
- jarr . Add ( new
88
+ jarr . Add ( JObject . FromObject ( new
89
89
{
90
90
id = item . AnswerId ,
91
91
answer = item . Answer
92
- } ) ;
92
+ } ) ) ;
93
93
}
94
94
95
95
return client . SendActionAsync ( new HttpAction < MojangAPIResponse >
@@ -103,10 +103,10 @@ public Task<MojangAPIResponse> SendAnswers(QuestionList list, string accessToken
103
103
{ "Authorization" , "Bearer " + accessToken }
104
104
} ,
105
105
106
- Content = new StringContent ( jarr . ToString ( ) ) ,
106
+ Content = new StringContent ( jarr . ToString ( ) , Encoding . UTF8 , "application/json" ) ,
107
107
108
108
ResponseHandler = HttpResponseHandlers . GetSuccessCodeResponseHandler ( new MojangAPIResponse ( ) ) ,
109
- ErrorHandler = null
109
+ ErrorHandler = HttpResponseHandlers . GetJsonErrorHandler < MojangAPIResponse > ( )
110
110
} ) ;
111
111
}
112
112
}
0 commit comments