OpenEdge.Net.HTTP.HttpRequest:ContentLength

Posted by ntwatkins on 12-Aug-2015 11:29

I am using 11.5.1.  Should I be able to query the OpenEdge.Net.HTTP.HttpRequest:ContentLength property?  The property seems to always be set to 0 (zero).

Thanks,

Nick

Posted by Peter Judge on 12-Aug-2015 15:21

As things stand today, the request's ContentLength is only set right before the message is sent to the server. So it'll have a value after the Execute() call, but not before.

This is because the conversion from whatever the Entity (payload) is into a series of bytes only happens on execution. It doesn't happen when you set the Entity, for reasons which largely have to do with not wanting to keep 2 copies of the data in memory  (bytes and 'real format') for longer than necessary.

What do you use and/or need the request's content length for?

All Replies

Posted by Peter Judge on 12-Aug-2015 15:21

As things stand today, the request's ContentLength is only set right before the message is sent to the server. So it'll have a value after the Execute() call, but not before.

This is because the conversion from whatever the Entity (payload) is into a series of bytes only happens on execution. It doesn't happen when you set the Entity, for reasons which largely have to do with not wanting to keep 2 copies of the data in memory  (bytes and 'real format') for longer than necessary.

What do you use and/or need the request's content length for?

Posted by ntwatkins on 12-Aug-2015 15:59

I was trying to debug an issue I was having with a Json parsing error.  It would only occur when the length of the payload was more than about 280K.  However, I found the issue with the data and corrected it.

Thanks,

Nick

This thread is closed