mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-07 16:19:02 +02:00
8a0f2dbe1d
Use the request logger for errors in web GitOrigin-RevId: f654fc69e0bbdab8b16d23b007aefbad08925358
33 lines
580 B
JavaScript
33 lines
580 B
JavaScript
const sinon = require('sinon')
|
|
|
|
class MockRequest {
|
|
constructor() {
|
|
this.session = { destroy() {} }
|
|
|
|
this.ip = '42.42.42.42'
|
|
this.headers = {}
|
|
this.params = {}
|
|
this.query = {}
|
|
this.body = {}
|
|
this._parsedUrl = {}
|
|
this.i18n = {
|
|
translate(str) {
|
|
return str
|
|
},
|
|
}
|
|
this.route = { path: '' }
|
|
this.accepts = () => {}
|
|
this.setHeader = () => {}
|
|
this.logger = {
|
|
addFields: sinon.stub(),
|
|
setLevel: sinon.stub(),
|
|
}
|
|
}
|
|
|
|
param(param) {
|
|
return this.params[param]
|
|
}
|
|
}
|
|
|
|
module.exports = MockRequest
|