Skip to content

getResponseBody code to load by bodyid #150

Open
@dimension85

Description

@dimension85

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions