I have an ASP.Net handler that returns a PDF report. I want the Azure Logic App to request the file and then add it to an e-mail as an attachment.
When I try to do this through an HTTP request I get the following error:
BadRequest. Http request failed as there is an error: 'Error while copying content to a stream.'
If I make the request with a browser I get a HTTP 200 response and it works. See request/response headers from chrome and fiddler.
I'm sure I could solve this with an Azure Function to get the file blob and pass it to the e-mail stage but it appears in the documentation that Logic Apps can handle streams and base64 encode. Am I missing something here?
I tried with the following a static result in an HTTP request to mimic the HTTP request/stream as much as possible. I guess it comes down to that you need to design the body of the stream in a way the includes content and content-type like I did below with my mockup HTTP request
pdf content
content-type: application/pdf and application/octet-stream worked
Send and email action:
Sent email
Outlook result:
Related
I am working with Twilio Flow to create a WhatsApp Chat bot.
This bot allows user to start chat and respond with specific terms or numbers to proceed. It works fine, now I have added "Make HTTP Request" WIDGET to call an URL for posting the data received in response to DB.
When the HTTP Request is made, it returns FAIL & SUCCESS for some reasons,
On checking logs, i found out that a URL when any parameter is without any space or any special character, HTTP request gets success with Response code 200, but when its more than a word with added space or any special character HTTP request is failed and returned with Response code 500.
HTTP Request URL :
https://websiteurl.com/page.php?whatsapp_number={{contact.channel.address}}&message={{widgets.ReplyReceived5.inbound.Body}}
I also tried to make HTTP Request to https://webhook.site, but it also failed.
Added SUCCESS and FAILED Request Screenshot below.
Any help to fix this?
Image of HTTP Request getting SUCCESS with response code 200, Message parameter in URL without any space or special character
Image of HTTP Request FAILED with response code 500, Message parameter in URL with space
Twilio developer evangelist here.
In Studio, you can use HTTP Params and GET which will do the encoding (to handle spaces) for you. Or, you could use Liquid Filtering like {{ widgets.boop.di.doop | url_encode }}. My amazing coworker and Studio wizard Craig Dennis recommends using HTTP params.
Let me know if this helps at all!
My pdf file is being sent to my server as binary data with Postman as seen in the picture attached.
The content of the file is being parsed on my ExpressJS server with req.on((chunk) => ...) etc.
Everything is fine, except the fact that I try to obtain the original filename(highlighted in red - valid-compressed-compressed.pdf) on the server, but I can't find the value anywhere in the request object.
Any suggestions, please?
Short answer: you cant.
If you look closely at the headers being sent with the request, there are no headers containing the filename. Therefore there are no headers you can access in express to retrieve that information. The only headers you send are Content-Type and Content-Length that gives some information about what you're sending. Other than that there's just the binary request body.
If you want to post a file and the filename you need to look into multipart/form-data (Multer).
I'm trying to log in into a site which requires grcp content-type using requests. I alrady have a HTTP 2 client, but I don't know how body of my post request should look like.
When I'm trying to simply copy request as a curl from chrome network tab, request body looks like this:
%äEMAIL"PASSWORD(0
When I'm trying to request site with same body as I copied from chrome tab, I'mm getting response with this headers:
Grpc-Message: grpc: received message larger than max (218767392 vs. 4194304)
Grpc-Status: 8
I'm sure It's becouse wrong payload format
If anybody knows how can I pass data in request plase help.
If you're trying to send a one-off gRPC request, https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md would be helpful to know as to how to construct a message. Otherwise, using gRPC clients (https://github.com/grpc/grpc) would make more sense.
I have an API end-point which takes a query string as url-encoded form data and returns a json.
I have used "Content-Type":"application/x-www-form-urlencoded" as headers.
When I try sending "query=xxx" as body of http post call using composer I get an error in emulator saying "The parent is missing.".
When I try sending {"query":"xxx"} as body, I get an error in emulator saying :
Misused header name. Make sure request headers are used with HttpRequestMessage, response headers with HttpResponseMessage, and content headers with HttpContent objects.
In which format should I send the data?
You should send it like this:
URL:http://localhost:7071/api/GetStudentGrade
Body(string):studentID=${user.studentID}&coursecode=${user.coursecode}
Content type:application/x-www-form-urlencoded
Detailed image:
I think you have to change the body to an object, Also content type to application/json. Let me know if this resolves your issue.
I'm using ZombieJS v4 (4.0.13), and am trying to access the client's request body, since some tests require me to monitor the fields that are automatically sent via client forms.
While I can access all the query-string fields by using the pipeline's addHandler hook, I can't seem to read the request body in order to extract body post params.
Working with the response body is easy - I can access it from the pipeline by waiting for the response to consume. But the request body always appears as null, with _bodyUsed = true, so I can't wait for it in the same manner.
Anyone knows of a way I can access the sent request body, either via the pipeline, or somewhere else?
10x