File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
templates/dotnet/src/Appwrite Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -232,9 +232,11 @@ namespace {{ spec.title | caseUcfirst }}
232
232
if (code >= 400) {
233
233
var message = await response.Content.ReadAsStringAsync();
234
234
235
- var contentType = response.Content.Headers
236
- .GetValues("Content-Type")
237
- .FirstOrDefault() ?? string.Empty;
235
+ string contentType = string.Empty;
236
+ if (response.Content.Headers.TryGetValues("Content-Type", out var contentTypes))
237
+ {
238
+ contentType = contentTypes.FirstOrDefault() ?? string.Empty;
239
+ }
238
240
239
241
if (contentType.Contains("application/json")) {
240
242
message = JObject.Parse(message)["message"]!.ToString();
@@ -267,9 +269,11 @@ namespace {{ spec.title | caseUcfirst }}
267
269
var response = await _http.SendAsync(request);
268
270
var code = (int)response.StatusCode;
269
271
270
- var contentType = response.Content.Headers
271
- .GetValues("Content-Type")
272
- .FirstOrDefault() ?? string.Empty;
272
+ string contentType = string.Empty;
273
+ if (response.Content.Headers.TryGetValues("Content-Type", out var contentTypes))
274
+ {
275
+ contentType = contentTypes.FirstOrDefault() ?? string.Empty;
276
+ }
273
277
274
278
var isJson = contentType.Contains("application/json");
275
279
You can’t perform that action at this time.
0 commit comments