donobu
Version:
Create browser automations with an LLM agent and replay them as Playwright scripts.
32 lines • 1.26 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.DefaultApiAuthApi = void 0;
const UnparseableJsonBodyException_1 = require("../exceptions/UnparseableJsonBodyException");
/**
* API handler for managing default API authentication settings
*/
class DefaultApiAuthApi {
constructor(requestContextHolder) {
this.requestContextHolder = requestContextHolder;
}
/**
* Sets the default API authentication context
*
* @param req - Express request object
* @param res - Express response object
* @throws UnparseableJsonBodyException if the request body cannot be parsed
*/
async setDefaultApiAuth(req, res) {
// Validate and parse the request body as RequestContext
if (!req.body || typeof req.body !== 'object') {
throw new UnparseableJsonBodyException_1.UnparseableJsonBodyException('Invalid request body');
}
const defaultRequestContext = req.body;
// Set the fallback context
this.requestContextHolder.setFallbackContext(defaultRequestContext);
// Send success response
res.status(200).send();
}
}
exports.DefaultApiAuthApi = DefaultApiAuthApi;
//# sourceMappingURL=DefaultApiAuthApi.js.map