We have an existing API to set the error body (TSHttpTxnErrorBodyGet() ), and I’d like to add the corresponding Get’er for this. I’m proposing the following:
/** Retrives the error body, if any, from a transaction. This would be a body as set via the API body. @param txnp HTTP transaction whose parent proxy to get. @param buflength Optional output pointer to the length of the body message. @param mimetype Optional output pointer to the MIME type of the response. */ char *TSHttpTxnErrorBodyGet(TSHttpTxn txnp, size_t *buflength, char **mimetype); The buflength and mimetype are pointers (output), which can be nullptr’s. If they are provided, the length and/or mimetype pointer as set using the TSHttpTxnErrorBodyGet() is also returned. The return value is the body string. This new API would return a nullptr if no error body has been set via the TSHttpTxnErrorBodySet() API. Cheers, — Leif Thanks to Jasmine Emanuoel for some great ideas around how to use these APIs together with HTTP Txn errors.