-
-
Save hatsunea/d78313e864085763f74953577f7f4314 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task Verify() | |
{ | |
var result = await PickAndShow(PickOptions.Default); | |
this.FileName = result.FullPath; | |
using (var client = new HttpClient()) | |
{ | |
client.DefaultRequestHeaders.CacheControl = new CacheControlHeaderValue { NoCache = true, }; | |
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", this.Token); | |
using (var multipartContent = new MultipartFormDataContent()) | |
{ | |
using (var fileContent = new StreamContent(File.OpenRead(this.FileName))) | |
{ | |
fileContent.Headers.ContentDisposition = new ContentDispositionHeaderValue("form-data") | |
{ | |
Name = "vein", | |
FileName = Path.GetFileName(this.FileName), | |
}; | |
fileContent.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream"); | |
multipartContent.Add(fileContent); | |
using (var response = await client.PostAsync(@"https://apigateway.research.global.fujitsu.com/vlcb/research/verify-match", multipartContent)) | |
{ | |
if (response.IsSuccessStatusCode) | |
{ | |
// リクエストが成功した場合の処理 | |
this.Response = "Success"; | |
} | |
else | |
{ | |
// リクエストが失敗した場合の処理 | |
this.Response = response.StatusCode.ToString(); | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment