File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ export * from './http/delay.js';
3232export * from './http/cookies.js'
3333export * from './http/basic-auth.js' ;
3434export * from './http/json.js' ;
35+ export * from './http/xml.js' ;
3536export * from './http/trailers.js' ;
3637export * from './http/error/close.js' ;
3738export * from './http/error/reset.js' ;
Original file line number Diff line number Diff line change 1+ import { HttpEndpoint , HttpHandler } from '../http-index.js' ;
2+
3+ const matchPath = ( path : string ) => path === '/xml' ;
4+
5+ const handle : HttpHandler = ( req , res ) => {
6+ res . writeHead ( 200 , {
7+ 'content-type' : 'application/xml'
8+ } ) ;
9+
10+ // HTTPBin seems to just return this fixed example document:
11+ res . end ( `<?xml version='1.0' encoding='us-ascii'?>
12+
13+ <!-- A SAMPLE set of slides -->
14+
15+ <slideshow
16+ title="Sample Slide Show"
17+ date="Date of publication"
18+ author="Yours Truly"
19+ >
20+
21+ <!-- TITLE SLIDE -->
22+ <slide type="all">
23+ <title>Wake up to WonderWidgets!</title>
24+ </slide>
25+
26+ <!-- OVERVIEW -->
27+ <slide type="all">
28+ <title>Overview</title>
29+ <item>Why <em>WonderWidgets</em> are great</item>
30+ <item/>
31+ <item>Who <em>buys</em> WonderWidgets</item>
32+ </slide>
33+
34+ </slideshow>` ) ;
35+ }
36+
37+ export const xml : HttpEndpoint = {
38+ matchPath,
39+ handle
40+ } ;
You can’t perform that action at this time.
0 commit comments