Extracting request data in Compute Service

Comments

3 comments

  • Elliot Maguire

    Hey Vinaayakh,

    I believe you'll find what you're looking for here in our docs. There's a Fiddle on that page that shows how to do this. I've copied it here and added a few clarifying comments. Here's the important bit to note: 

    Since the bodies of HTTP requests and responses in Compute@Edge are streams, we are consuming the stream to its end and then logging the resulting data. In JavaScript once the .body property of a request or response has been read it cannot be used by fetch or respondWith, so we use the extracted body data to construct a new Request or Response after logging the body.

    The logging solution in the Fiddle should point you in the right direction. Let me know if you have any questions about it!
     
     
    Kind regards,
    Elliot | Fastly Support
    0
    Comment actions Permalink
  • Vinaayakh

    Thanks Elliot this did work for me.

    0
    Comment actions Permalink
  • Elliot Maguire

    Happy to help!

     

    Kind regards,
    Elliot | Fastly Support
    0
    Comment actions Permalink

Please sign in to leave a comment.