Skip to content

Commit 92ae943

Browse files
committed
clean up header name
1 parent 7d2183f commit 92ae943

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

docs/openapi/headers.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ location:
99
schema:
1010
type: string
1111

12-
xDaContinuationToken:
12+
daContinuationToken:
1313
description: Continuation token for fetching the next page of list results.
1414
schema:
1515
type: string

docs/openapi/responses.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ list:
3636
'200':
3737
description: The list of sources
3838
headers:
39-
X-da-continuation-token:
40-
$ref: "./headers.yaml#/xDaContinuationToken"
39+
da-continuation-token:
40+
$ref: "./headers.yaml#/daContinuationToken"
4141
content:
4242
application/json:
4343
schema:

src/utils/daResp.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default function daResp({
3333
headers.append('Access-Control-Allow-Origin', '*');
3434
headers.append('Access-Control-Allow-Methods', 'HEAD, GET, PUT, POST, DELETE');
3535
headers.append('Access-Control-Allow-Headers', '*');
36-
headers.append('Access-Control-Expose-Headers', 'X-da-actions, X-da-child-actions, X-da-acltrace, X-da-id, X-da-continuation-token, ETag');
36+
headers.append('Access-Control-Expose-Headers', 'X-da-actions, X-da-child-actions, X-da-acltrace, X-da-id, da-continuation-token, ETag');
3737
headers.append('Content-Type', contentType);
3838
if (contentLength) {
3939
headers.append('Content-Length', contentLength);
@@ -50,7 +50,7 @@ export default function daResp({
5050
headers.append('ETag', etag);
5151
}
5252
if (continuationToken) {
53-
headers.append('X-da-continuation-token', continuationToken);
53+
headers.append('da-continuation-token', continuationToken);
5454
}
5555

5656
if (ctx?.aclCtx && status < 500) {

test/index.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ describe('fetch', () => {
113113

114114
const resp = await hnd.fetch({ method: 'GET', url: 'http://www.example.com/list/org/repo/path' }, {});
115115
assert.strictEqual(resp.status, 200);
116-
assert.strictEqual(resp.headers.get('X-da-continuation-token'), 'next-token');
116+
assert.strictEqual(resp.headers.get('da-continuation-token'), 'next-token');
117117
});
118118
});
119119

test/utils/daResp.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe('DA Resp', () => {
2828
assert.strictEqual('*', resp.headers.get('Access-Control-Allow-Origin'));
2929
assert.strictEqual('HEAD, GET, PUT, POST, DELETE', resp.headers.get('Access-Control-Allow-Methods'));
3030
assert.strictEqual('*', resp.headers.get('Access-Control-Allow-Headers'));
31-
assert.strictEqual('X-da-actions, X-da-child-actions, X-da-acltrace, X-da-id, X-da-continuation-token, ETag', resp.headers.get('Access-Control-Expose-Headers'));
31+
assert.strictEqual('X-da-actions, X-da-child-actions, X-da-acltrace, X-da-id, da-continuation-token, ETag', resp.headers.get('Access-Control-Expose-Headers'));
3232
assert.strictEqual('text/plain', resp.headers.get('Content-Type'));
3333
assert.strictEqual('777', resp.headers.get('Content-Length'));
3434
assert.strictEqual('/foo/bar.html=read,write', resp.headers.get('X-da-actions'));
@@ -49,7 +49,7 @@ describe('DA Resp', () => {
4949
assert.strictEqual('*', resp.headers.get('Access-Control-Allow-Origin'));
5050
assert.strictEqual('HEAD, GET, PUT, POST, DELETE', resp.headers.get('Access-Control-Allow-Methods'));
5151
assert.strictEqual('*', resp.headers.get('Access-Control-Allow-Headers'));
52-
assert.strictEqual('X-da-actions, X-da-child-actions, X-da-acltrace, X-da-id, X-da-continuation-token, ETag', resp.headers.get('Access-Control-Expose-Headers'));
52+
assert.strictEqual('X-da-actions, X-da-child-actions, X-da-acltrace, X-da-id, da-continuation-token, ETag', resp.headers.get('Access-Control-Expose-Headers'));
5353
assert.strictEqual('application/json', resp.headers.get('Content-Type'));
5454
assert(!resp.headers.get('Content-Length'));
5555
assert.strictEqual('/foo/blah.html=read', resp.headers.get('X-da-actions'));
@@ -76,7 +76,7 @@ describe('DA Resp', () => {
7676
const ctx = { key: 'foo/bar.html', aclCtx };
7777
const resp = daResp({ status: 200, body: 'foobar' }, ctx);
7878
assert.strictEqual(200, resp.status);
79-
assert.strictEqual('X-da-actions, X-da-child-actions, X-da-acltrace, X-da-id, X-da-continuation-token, ETag', resp.headers.get('Access-Control-Expose-Headers'));
79+
assert.strictEqual('X-da-actions, X-da-child-actions, X-da-acltrace, X-da-id, da-continuation-token, ETag', resp.headers.get('Access-Control-Expose-Headers'));
8080
assert.strictEqual('/haha/hoho/**=read,write', resp.headers.get('X-da-child-actions'));
8181
});
8282
});

0 commit comments

Comments
 (0)