| 185 | |
| 186 | // Currently only used for tests. |
| 187 | async addSession(request: AddSessionRequest): Promise<void> { |
| 188 | await new Promise<void>((resolve, reject) => { |
| 189 | const opts = { |
| 190 | path: "/add-session", |
| 191 | socketPath: this.codeServerSocketPath, |
| 192 | method: "POST", |
| 193 | headers: { |
| 194 | "content-type": "application/json", |
| 195 | accept: "application/json", |
| 196 | }, |
| 197 | } |
| 198 | const req = http.request(opts, () => { |
| 199 | resolve() |
| 200 | }) |
| 201 | req.on("error", reject) |
| 202 | req.write(JSON.stringify(request)) |
| 203 | req.end() |
| 204 | }) |
| 205 | } |
| 206 | } |