@thisisagile/easy-test
Version:
Straightforward library for testing microservices built with @thisisagile/easy
39 lines (37 loc) • 837 B
JavaScript
import {
asNumber,
isDefined
} from "./chunk-O475TEG2.mjs";
// src/utils/Req.ts
var Req = class {
constructor(state = {}) {
this.state = state;
this.skip = isDefined(this.query?.skip) ? asNumber(this.query?.skip) : void 0;
this.take = isDefined(this.query?.take) ? asNumber(this.query?.take) : void 0;
}
skip;
take;
get id() {
return this.state.id ?? this.path.id;
}
get q() {
return this.state.q ?? this.query.q;
}
get path() {
return this.state?.path ?? {};
}
get query() {
return this.state?.query ?? {};
}
get body() {
return this.state.body;
}
get headers() {
return this.state.headers;
}
get = (key) => this?.state[key.toString()] ?? this.path[key.toString()] ?? this.query[key.toString()];
};
export {
Req
};
//# sourceMappingURL=chunk-SJR3TRWF.mjs.map