HTTP Request - How to know the file type I'm downloading?


Basically I’m trying to download an attachment using an HTTP Request. Everything was fine until I found that the file I want to download might have different extensions (PNG, PDF, JPEG). Because of that I can’t fill the ResourcePath field with the extension of the file…

By looking to the headers response, I could see the file extension, nonetheless that won’t allow me to fill the ResourcePath field in the same acitvity right?

I also looked at the result field from the HTTP request and when the file is JPEG the result it’s a JFIF file, otherwise it will be a PDF.

My ultimate goal is to download that file, with no regards to the file extension, and transform it into a JSON Object. Is it possible?

Best Regards,

Not sure how your json response looks like but, If you deserialize json you are receiving that will give you the extension of the file, right?

then you can just add the corresponding extension in the Resource Path’s end

Hope this helps!