Skip to content

Commit cec3853

Browse files
committed
[v1] Added access log for POST/PATCH/DELETE requests that the repo receives
1 parent 2e211b4 commit cec3853

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/scripts/repo/main.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,17 +156,20 @@ try {
156156
}),
157157

158158
'POST': responder((params, req) => {
159+
var body = req.body.toString()
160+
console.log('POST', req.head.path, 'BODY', body.toString())
159161
var path = '/' + params['*']
160-
var body = req.body
161-
var info = body && body.size > 0 ? JSON.decode(body) : {}
162+
var info = JSON.parse(body || '{}')
162163
var codebase = store.newCodebase(path, info.base)
163164
return response(201, codebase.getInfo())
164165
}),
165166

166167
'PATCH': responder((params, req) => {
168+
var body = req.body.toString()
169+
console.log('PATCH', req.head.path, 'BODY', body.toString())
167170
var path = '/' + params['*']
168171
var body = req.body
169-
var info = body && body.size > 0 ? JSON.decode(body) : {}
172+
var info = JSON.parse(body || '{}')
170173
var codebase = store.getCodebase(path)
171174
if (codebase) {
172175
if (info.version !== codebase.getVersion()) {
@@ -178,6 +181,7 @@ try {
178181
}),
179182

180183
'DELETE': responder(params => {
184+
console.log('DELETE', req.head.path)
181185
var path = '/' + params['*']
182186
store.deleteCodebase(path)
183187
return response(204)

src/scripts/repo/store.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ export default function (repoRoot) {
185185
var k = queue.pop()
186186
var cb = codebases[k]
187187
if (cb) {
188-
println(version)
189188
cb.generate(t)
190189
cb.getDerived().filter(k => !done.has(k)).forEach(
191190
k => queue.push(k)
@@ -236,7 +235,7 @@ export default function (repoRoot) {
236235
paths.forEach(
237236
p => {
238237
var fullpath = os.path.join(prefix, p)
239-
var v = version
238+
var v = version.toString()
240239
var t = ts
241240
var pt = patched[p]
242241
if (pt) {

0 commit comments

Comments
 (0)