B:BD[
5.159] → [
7.198:431]
B:BD[
7.491] → [
7.491:552]
B:BD[
9.295] → [
9.295:302]
B:BD[
9.302] → [
7.553:612]
http_body_len := headers['Content-Length'].int()
mut body_bytes := []byte{len: int(http_body_len)}
read_count := reader.read(mut body_bytes) or { 0 }
if read_count > 0 {
body := body_bytes.bytestr()
body_replace := body.replace(r'$', '_')
if payload := json2.raw_decode(body_replace) {
println('decoded: $payload')
events := payload.as_map()['events'].arr()
for idx, evt in events {
println('Event ${idx+1}/$events.len')
self.out <- Command{
data: evt.as_map()
}
}
} else {
println('appsvc body decode error $err')
self.process_request(headers, mut reader)
}
respond(conn, 200, '{}')
}
}
pub fn (mut self AppsvcActor) process_request(headers map[string]string, mut reader &io.BufferedReader) {
http_body_len := headers['Content-Length'].int()
mut body_bytes := []byte{len: int(http_body_len)}
read_count := reader.read(mut body_bytes) or { 0 }
if read_count > 0 {
body := body_bytes.bytestr()
body_replace := body.replace(r'$', '_') // temporary vlang json workaround
if payload := json2.raw_decode(body_replace) {
println('decoded: $payload')
events := payload.as_map()['events'].arr()
for idx, evt in events {
println('Event ${idx + 1}/$events.len')
self.out <- Command{
data: evt.as_map()