Grpc before invoke script not able to retrieve message data the actual request data that is sent

In grpc request to retrieve the request data I tried pm.request but if I use under before invoke the message section is empty but if I use it under after response the pm.request message section has data

Is there a way to get the request data in the before invoke script

I need to do some calculations before invoking with request data and validate against the response data

Thank you in Advance

From the blurb.

The pm.request object provides access to the data for the request the script is running within. For a Pre-request Script this is the request that’s about to run, and for a Test script this is the request that has already run.

Sounds like this needs to be in the pre-request script.

Sample data what I am looking for

Request string in the Before invoke{“id”:“636061423599ae7c03604497”,“name”:“grpc://localhost:9091”,“url”:{“host”:[“g-p7pykxy4kpop1nonwl761z5mnl68w2”,“srv”,“pstmn”,“io”],“query”:,“variable”:},“methodPath”:“user.login”,“auth”:{},“metadata”:,“messages”:}

here Message section is empty, I was expecting data

But in the After response

Request string in the After response{“id”:“636061423599ae7c03604497”,“name”:“grpc://localhost:9091”,“url”:{“host”:[“g-p7pykxy4kpop1nonwl761z5mnl68w2”,“srv”,“pstmn”,“io”],“query”:,“variable”:},“methodPath”:“user.login”,“auth”:{},“metadata”:,“messages”:[{“data”:{“password”:“demo”,“username”:“test”},“timestamp”:“2022-11-07T17:11:05.390Z”}]}

After response has message data
username and Password

@kadayalan Thanks for reporting the issue!

We have fixed this in the latest release of the app (v10.4.1) and you should now have access to the request message in the Before invoke script as well for Unary and Server streaming methods.

@kadayalan We have made a change to the data exposed by our API. With Postman v10.5.6, request message data in Before invoke script will be a string instead of a Javascript object.

You can convert it to an object using the below snippet in your script:

const message = JSON.parse(pm.request.messages.idx(0).data);

Note: This only affects the Before invoke script. After response scripts will continue to work as is.

Thank you will check on it