Mercurial > hg
view tests/test-locate.t @ 37049:55e901396005
hgweb: also set Content-Type header
Our HTTP/WSGI server may convert the Content-Type HTTP request
header to the CONTENT_TYPE WSGI environment key and not set
HTTP_CONTENT_TYPE. Other WSGI server implementations
do this, so I think the behavior is acceptable.
So assuming this HTTP request header could get "lost" by the WSGI
server, let's restore it on the request object like we do for
Content-Length.
FWIW, the WSGI server may also *invent* a Content-Type value. The
default behavior of Python's RFC 822 message class returns a default
media type if Content-Type isn't defined. This is kind of annoying.
But RFC 7231 section 3.1.1.5 does say the recipient may assume a media
type of application/octet-stream. Python's defaults are for
text/plain (given we're using an RFC 822 parser). But whatever.
Differential Revision: https://phab.mercurial-scm.org/D2849
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Tue, 13 Mar 2018 14:15:10 -0700 |
parents | 821d8a5ab4ff |
children | 34ba47117164 |
line wrap: on
line source
$ hg init repo $ cd repo $ echo 0 > a $ echo 0 > b $ echo 0 > t.h $ mkdir t $ echo 0 > t/x $ echo 0 > t/b $ echo 0 > t/e.h $ mkdir dir.h $ echo 0 > dir.h/foo $ hg ci -A -m m adding a adding b adding dir.h/foo adding t.h adding t/b adding t/e.h adding t/x $ touch nottracked $ hg locate a a $ hg locate NONEXISTENT [1] $ hg locate a b dir.h/foo t.h t/b t/e.h t/x $ hg rm a $ hg ci -m m $ hg locate a [1] $ hg locate NONEXISTENT [1] $ hg locate relpath:NONEXISTENT [1] $ hg locate b dir.h/foo t.h t/b t/e.h t/x $ hg locate -r 0 a a $ hg locate -r 0 NONEXISTENT [1] $ hg locate -r 0 relpath:NONEXISTENT [1] $ hg locate -r 0 a b dir.h/foo t.h t/b t/e.h t/x -I/-X with relative path should work: $ cd t $ hg locate b dir.h/foo t.h t/b t/e.h t/x $ hg locate -I ../t t/b t/e.h t/x Issue294: hg remove --after dir fails when dir.* also exists $ cd .. $ rm -r t $ hg rm t/b $ hg locate 't/**' t/b t/e.h t/x $ hg files b dir.h/foo t.h t/e.h t/x $ hg files b b -X with explicit path: $ hg files b -X b [1] $ mkdir otherdir $ cd otherdir $ hg files path: ../b ../dir.h/foo ../t.h ../t/e.h ../t/x $ hg files path:. ../b ../dir.h/foo ../t.h ../t/e.h ../t/x $ hg locate b ../b ../t/b $ hg locate '*.h' ../t.h ../t/e.h $ hg locate path:t/x ../t/x $ hg locate 're:.*\.h$' ../t.h ../t/e.h $ hg locate -r 0 b ../b ../t/b $ hg locate -r 0 '*.h' ../t.h ../t/e.h $ hg locate -r 0 path:t/x ../t/x $ hg locate -r 0 're:.*\.h$' ../t.h ../t/e.h $ hg files ../b ../dir.h/foo ../t.h ../t/e.h ../t/x $ hg files . [1] Convert native path separator to slash (issue5572) $ hg files -T '{path|slashpath}\n' ../b ../dir.h/foo ../t.h ../t/e.h ../t/x $ cd ../..