Skip to content

Commit

Permalink
[ci] format
Browse files Browse the repository at this point in the history
  • Loading branch information
natemoo-re authored and astrobot-houston committed Oct 12, 2023
1 parent 3917296 commit 45ae41a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
28 changes: 14 additions & 14 deletions packages/astro/src/core/endpoint/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,27 +60,27 @@ export function createAPIContext({
if (clientAddressSymbol in request) {
return Reflect.get(request, clientAddressSymbol) as string;
}
if (adapterName) {
throw new AstroError({
...AstroErrorData.ClientAddressNotAvailable,
message: AstroErrorData.ClientAddressNotAvailable.message(adapterName),
});
} else {
throw new AstroError(AstroErrorData.StaticClientAddressNotAvailable);
}
if (adapterName) {
throw new AstroError({
...AstroErrorData.ClientAddressNotAvailable,
message: AstroErrorData.ClientAddressNotAvailable.message(adapterName),
});
} else {
throw new AstroError(AstroErrorData.StaticClientAddressNotAvailable);
}
},
get locals() {
let locals = Reflect.get(request, clientLocalsSymbol)
let locals = Reflect.get(request, clientLocalsSymbol);

if (locals === undefined) {
locals = {}
Reflect.set(request, clientLocalsSymbol, locals)
locals = {};
Reflect.set(request, clientLocalsSymbol, locals);
}

if (typeof locals !== 'object') {
throw new AstroError(AstroErrorData.LocalsNotAnObject);
}

return locals;
},
// We define a custom property, so we can check the value passed to locals
Expand Down
4 changes: 2 additions & 2 deletions packages/integrations/node/test/locals.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('API routes', () => {
url: '/from-node-middleware',
});

handler(req, res, undefined, "locals");
handler(req, res, undefined, 'locals');
req.send();

await done;
Expand All @@ -46,7 +46,7 @@ describe('API routes', () => {

it('Can use locals added by astro middleware', async () => {
const { handler } = await import('./fixtures/locals/dist/server/entry.mjs');

const { req, res, text } = createRequestAndResponse({
url: '/from-astro-middleware',
});
Expand Down

0 comments on commit 45ae41a

Please sign in to comment.