I’m trying to upload a crash dump file to sentry using HTTP. I followed the online guides and I can successfully upload using curl, but our target platform might not have curl, so I want to be able to do it using a generic HTTP request. In essence, I’m trying to build the following curl command in HTTP:
curl.exe -v POST https://xxxxxx.ingest.sentry.io/api/xxxxxxx/minidump/?sentry_key=xxxxxxxxxxxxxxxxxxxxxxx -F upload_file_minidump=@"C:\path\Minidump.dmp" -F upload_file_log=@"C:\path\program.log"
As far as I understand, curl turns this into a multipart/form-data HTTP request, but I can’t figure out how to properly attach the dmp to this. This is what my code looks like (c++ in unreal engine, but we cannot use the default UE crash reporter)
`
FString jsonString;
TSharedRef<TJsonWriter> jsonWriter = TJsonWriterFactory::Create(&jsonString);
jsonWriter->WriteObjectStart();
jsonWriter->WriteValue(TEXT("Content-Disposition"), TEXT("form-data"));
jsonWriter->WriteValue(TEXT("name"), TEXT("upload_file_minidump"));
jsonWriter->WriteValue(TEXT("filename"), TEXT("Minidump.dmp"));
jsonWriter->WriteValue(TEXT("content"), FBase64::Encode(compressedData));
jsonWriter->WriteObjectEnd();
jsonWriter->Close();
// the json request
TSharedRef<IHttpRequest, ESPMode::ThreadSafe> httpRequest = FHttpModule::Get().CreateRequest();
httpRequest->SetVerb(TEXT("POST"));
httpRequest->SetHeader(TEXT("Content-Type"), TEXT("multipart/form-data; boundary=----------------------------------------auwifa9ab811"));
httpRequest->SetHeader(TEXT("Expect"), TEXT("100-continue"));
httpRequest->SetURL(TEXT("https://xxxxx.ingest.sentry.io/api/xxxxxxx/minidump/?sentry_key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"));
httpRequest->SetContentAsString(jsonString);
`
Some of the headers I’m setting are guesswork, based on my observed output from curl. Am I wrong to try to use json?
Thanks in advance!