overhaul tests

This commit is contained in:
Rich Harris
2018-10-07 18:23:43 -04:00
committed by GitHub
parent 18acef3190
commit 5e59855a15
183 changed files with 4145 additions and 3126 deletions

View File

@@ -0,0 +1,3 @@
<h1>{status}</h1>
<p>{error.message}</p>

View File

@@ -0,0 +1,11 @@
<h1>{message}</h1>
<script>
export default {
preload({ query }) {
return this.fetch(`credentials/test.json`, {
credentials: query.creds
}).then(r => r.json());
}
};
</script>

View File

@@ -0,0 +1,23 @@
import cookie from 'cookie';
export function get(req, res) {
if (req.headers.cookie) {
const cookies = cookie.parse(req.headers.cookie);
res.writeHead(200, {
'Content-Type': 'application/json'
});
res.end(JSON.stringify({
message: `a: ${cookies.a}, b: ${cookies.b}, max-age: ${cookies['max-age']}`
}));
} else {
res.writeHead(403, {
'Content-Type': 'application/json'
});
res.end(JSON.stringify({
message: 'unauthorized'
}));
}
}

View File

@@ -0,0 +1,3 @@
<h1>Great success!</h1>
<a href="credentials?creds=include">link</a>