cancel
Showing results for 
Search instead for 
Did you mean: 

CAP - Custom Header/Compression

01-12-2022 5:13 PM
kevin_balboni1 Participant
1218 views 1 comments Go to solution
0 Likes
SAP Managed Tags
Subscribe

Dear Experts,

we need to compress as much as possible the amount of data we are transferring through a custom action.
We wish we could use gzip compression, which we are able to do, but we cannot set the response header with 'Content-Encoding' equal to 'gzip', consequently the front-end (SAPUI5) fails to convert it.

Action definition:

Action handler:

const { gzip, ungzip } = require("node-gzip");

We want that in the front-end we can get the string and then make a JSON parse, but this is what we get:

How can we achieve this?

Thanks

Kevin

0 Likes

Accepted Solutions (1)

Accepted Solutions (1)

kevin_balboni1
Participant
0 Likes

Just found a partial solution.

There is no need to manually compress the response payload. Through SAPUI5, by deactivating the batch, the calls will be automatically compressed in gzip.

this.getModel().setUseBatch(false);
this.getModel().create(sPath, {}, {
	success: function (oData) {
		this.getModel().setUseBatch(true);
		this.setBusy(false);

	}.bind(this),
	error: function (oError) {
		this.setBusy(false);
		this.getModel().setUseBatch(true);
	}.bind(this),
});

Answers (0)