--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-http-api-httpv2.t Tue Mar 13 16:53:21 2018 -0700
@@ -0,0 +1,65 @@
+ $ send() {
+ > hg --verbose debugwireproto --peer raw http://$LOCALIP:$HGPORT/
+ > }
+
+ $ hg init server
+ $ cat > server/.hg/hgrc << EOF
+ > [experimental]
+ > web.apiserver = true
+ > EOF
+ $ hg -R server serve -p $HGPORT -d --pid-file hg.pid
+ $ cat hg.pid > $DAEMON_PIDS
+
+HTTP v2 protocol not enabled by default
+
+ $ send << EOF
+ > httprequest GET api/exp-http-v2-0001
+ > user-agent: test
+ > EOF
+ using raw connection to peer
+ s> GET /api/exp-http-v2-0001 HTTP/1.1\r\n
+ s> Accept-Encoding: identity\r\n
+ s> user-agent: test\r\n
+ s> host: $LOCALIP:$HGPORT\r\n (glob)
+ s> \r\n
+ s> makefile('rb', None)
+ s> HTTP/1.1 404 Not Found\r\n
+ s> Server: testing stub value\r\n
+ s> Date: $HTTP_DATE$\r\n
+ s> Content-Type: text/plain\r\n
+ s> Content-Length: 33\r\n
+ s> \r\n
+ s> API exp-http-v2-0001 not enabled\n
+
+Restart server with support for HTTP v2 API
+
+ $ killdaemons.py
+ $ cat > server/.hg/hgrc << EOF
+ > [experimental]
+ > web.apiserver = true
+ > web.api.http-v2 = true
+ > EOF
+
+ $ hg -R server serve -p $HGPORT -d --pid-file hg.pid
+ $ cat hg.pid > $DAEMON_PIDS
+
+Requests simply echo their path (for now)
+
+ $ send << EOF
+ > httprequest GET api/exp-http-v2-0001/path1/path2
+ > user-agent: test
+ > EOF
+ using raw connection to peer
+ s> GET /api/exp-http-v2-0001/path1/path2 HTTP/1.1\r\n
+ s> Accept-Encoding: identity\r\n
+ s> user-agent: test\r\n
+ s> host: $LOCALIP:$HGPORT\r\n (glob)
+ s> \r\n
+ s> makefile('rb', None)
+ s> HTTP/1.1 200 OK\r\n
+ s> Server: testing stub value\r\n
+ s> Date: $HTTP_DATE$\r\n
+ s> Content-Type: text/plain\r\n
+ s> Content-Length: 12\r\n
+ s> \r\n
+ s> path1/path2\n