MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / sendEcho

Function sendEcho

javascript/selenium-webdriver/lib/test/fileserver.js:263–297  ·  view source on GitHub ↗
(request, response)

Source from the content-addressed store, hash-verified

261}
262
263function sendEcho(request, response) {
264 if (request.query['html']) {
265 const html = request.query['html']
266 if (html) {
267 response.writeHead(200, {
268 'Content-Length': Buffer.byteLength(html, 'utf8'),
269 'Content-Type': 'text/html; charset=utf-8',
270 })
271 response.end(html)
272 return
273 }
274 }
275
276 var body = [
277 '<!DOCTYPE html>',
278 '<title>Echo</title>',
279 '<div class="request">',
280 request.method,
281 ' ',
282 request.url,
283 ' ',
284 'HTTP/',
285 request.httpVersion,
286 '</div>',
287 ]
288 for (var name in request.headers) {
289 body.push('<div class="header ', name, '">', name, ': ', request.headers[name], '</div>')
290 }
291 body = body.join('')
292 response.writeHead(200, {
293 'Content-Length': Buffer.byteLength(body, 'utf8'),
294 'Content-Type': 'text/html; charset=utf-8',
295 })
296 response.end(body)
297}
298
299/**
300 * Responds to a request for the file server's main index.

Callers

nothing calls this directly

Calls 1

endMethod · 0.80

Tested by

no test coverage detected