Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getResponseBody code to load by bodyid #150

Open
dimension85 opened this issue Dec 17, 2021 · 0 comments
Open

getResponseBody code to load by bodyid #150

dimension85 opened this issue Dec 17, 2021 · 0 comments

Comments

@dimension85
Copy link

The API interface works fine if you know the request number, but the html body is easier to identify by the bodyid tag, which is not supported by the current API.

The following is an update to the getResponseBody code the enables both request and bodyid as options

function getResponseBody(id, options, callback) {
// WSI Mod - enables any parm to be parsed eg bodyid
var query;
let temp = options ; // WSI Mod - addition of temp
callback = callback || options;
options = options === callback ? {} : options;
options.args = options.args || {type: 'text/plain'};
query = setFilename({test: id}, options);
query.request = options.request || 1;

let merged = {};						//	WSI Mod - addition of temp obj	
Object.assign(merged, query, temp);		//	WSI Mod - merge original and new options
query = merged ;						//	WSI Mod - reload query

return api.call(this, paths.responseBody, callback, query, options);

}

Nothing else changes except in the call options={bodyid: xxxxxxxxxxxxxxxxxxxxxx} where xxxxxxxxxxxx is the bodyid now returns the html body. Request still works as expected.

Am running this as a local mod at the moment but would be appreciated if this could be included in a future API upgrade.

Regards
Phil

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant