I've in my API a method that return a content of PDF file.
How can I access the raw data of response in success callback?
I've in my API a method that return a content of PDF file.
How can I access the raw data of response in success callback?
Copyright © 2021 Jogjafile Inc.
All Siesta responses start out as raw data (in the form of the Foundation type
Data
), then run through the transformer pipeline.The default transformer pipeline parses JSON, text, and images based on the
Content-type
header sent by the server. That list doesn’t include PDF, so if your server is sending a content type ofapplication/pdf
(or anything that isn’t a JSON, text, or image content type), the response will still be rawData
at the end of the pipeline:If you aren’t getting
Data
— if the code above says “huh” — then something in your pipeline is transforming the response. You can use Siesta’s verbose logging to figure out what:Look in the log output for:
Added config
, which is logged when something adds a transformer to the pipeline,pipeline
section of theResulting configuration
before the request in question, which shows all the transformers that may apply to the response, andApplied transformer
andResponse after pipeline
to see how the actual server response gets transformed.