Skip to content

Commit

Permalink
Rename /status project root header (#2060)
Browse files Browse the repository at this point in the history
  • Loading branch information
huntie authored Aug 18, 2023
1 parent 7342221 commit 65e9bf1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ describe('statusPageMiddleware', () => {
statusPageMiddleware(mockReq, res);

// We're strictly checking response here, because React Native is strongly depending on this response. Changing the response might be a breaking change.
expect(res.setHeader).toHaveBeenCalledWith('Project-Root', '/mocked/path');
expect(res.setHeader).toHaveBeenCalledWith(
'X-React-Native-Project-Root',
'/mocked/path',
);
expect(res.end).toHaveBeenCalledWith('packager-status:running');
});
});
2 changes: 1 addition & 1 deletion packages/cli-server-api/src/statusPageMiddleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ export default function statusPageMiddleware(
_req: http.IncomingMessage,
res: http.ServerResponse,
) {
res.setHeader('Project-Root', process.cwd());
res.setHeader('X-React-Native-Project-Root', process.cwd());
res.end('packager-status:running');
}
2 changes: 1 addition & 1 deletion packages/cli-tools/src/isPackagerRunning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async function isPackagerRunning(
if (data === 'packager-status:running') {
return {
status: 'running',
root: headers.get('Project-Root') ?? '',
root: headers.get('X-React-Native-Project-Root') ?? '',
};
}
} catch (_error) {
Expand Down

0 comments on commit 65e9bf1

Please sign in to comment.