(err, res, body)
| 35 | let got; |
| 36 | |
| 37 | const afterRequest = (err, res, body) => { |
| 38 | if (err) return reject(err); |
| 39 | if (body && body.length) { |
| 40 | let destinations, |
| 41 | exits, |
| 42 | pronunciations, |
| 43 | instructions, |
| 44 | refs, |
| 45 | bearings, |
| 46 | turns, |
| 47 | modes, |
| 48 | times, |
| 49 | classes, |
| 50 | distances, |
| 51 | summary, |
| 52 | intersections, |
| 53 | lanes, |
| 54 | locations, |
| 55 | annotation, |
| 56 | weight_name, |
| 57 | weights, |
| 58 | approaches, |
| 59 | driving_sides; |
| 60 | |
| 61 | const json = JSON.parse(body); |
| 62 | |
| 63 | got.code = json.code; |
| 64 | |
| 65 | const hasRoute = json.code === 'Ok'; |
| 66 | |
| 67 | if (hasRoute) { |
| 68 | instructions = this.wayList(json.routes[0]); |
| 69 | pronunciations = this.pronunciationList(json.routes[0]); |
| 70 | refs = this.refList(json.routes[0]); |
| 71 | destinations = this.destinationsList(json.routes[0]); |
| 72 | exits = this.exitsList(json.routes[0]); |
| 73 | bearings = this.bearingList(json.routes[0]); |
| 74 | turns = this.turnList(json.routes[0]); |
| 75 | intersections = this.intersectionList(json.routes[0]); |
| 76 | modes = this.modeList(json.routes[0]); |
| 77 | driving_sides = this.drivingSideList(json.routes[0]); |
| 78 | classes = this.classesList(json.routes[0]); |
| 79 | times = this.timeList(json.routes[0]); |
| 80 | distances = this.distanceList(json.routes[0]); |
| 81 | lanes = this.lanesList(json.routes[0]); |
| 82 | summary = this.summary(json.routes[0]); |
| 83 | locations = this.locations(json.routes[0]); |
| 84 | annotation = this.annotationList(json.routes[0]); |
| 85 | weight_name = this.weightName(json.routes[0]); |
| 86 | weights = this.weightList(json.routes[0]); |
| 87 | approaches = this.approachList(json.routes[0]); |
| 88 | } |
| 89 | |
| 90 | if (headers.has('status')) { |
| 91 | got.status = res.statusCode.toString(); |
| 92 | } |
| 93 | |
| 94 | if (headers.has('message')) { |
nothing calls this directly
no test coverage detected