mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) updates from grist-core
This commit is contained in:
@@ -166,7 +166,7 @@ export async function openClient(server: FlexServer, email: string, org: string,
|
||||
const headers: Record<string, string> = {};
|
||||
if (!emailHeader) {
|
||||
const resp = await axios.get(`${server.getOwnUrl()}/test/session`);
|
||||
const cookie = resp.headers['set-cookie'][0];
|
||||
const cookie = resp.headers['set-cookie']![0];
|
||||
if (email !== 'anon@getgrist.com') {
|
||||
const cid = decodeURIComponent(cookie.split('=')[1].split(';')[0]);
|
||||
const comm = server.getComm();
|
||||
|
||||
@@ -1351,10 +1351,10 @@ function testDocApi() {
|
||||
}
|
||||
} else {
|
||||
if (sort) {
|
||||
config.headers['x-sort'] = sort.join(',');
|
||||
config.headers!['x-sort'] = sort.join(',');
|
||||
}
|
||||
if (limit) {
|
||||
config.headers['x-limit'] = String(limit);
|
||||
config.headers!['x-limit'] = String(limit);
|
||||
}
|
||||
}
|
||||
return axios.get(url.href, config);
|
||||
@@ -4976,11 +4976,11 @@ function testDocApi() {
|
||||
|
||||
const chimpyConfig = configForUser("Chimpy");
|
||||
const anonConfig = configForUser("Anonymous");
|
||||
delete chimpyConfig.headers["X-Requested-With"];
|
||||
delete anonConfig.headers["X-Requested-With"];
|
||||
delete chimpyConfig.headers!["X-Requested-With"];
|
||||
delete anonConfig.headers!["X-Requested-With"];
|
||||
|
||||
// Target a more realistic Host than "localhost:port"
|
||||
anonConfig.headers.Host = chimpyConfig.headers.Host = 'api.example.com';
|
||||
anonConfig.headers!.Host = chimpyConfig.headers!.Host = 'api.example.com';
|
||||
|
||||
const url = `${serverUrl}/api/docs/${docId}/tables/Table1/records`;
|
||||
const data = { records: [{ fields: {} }] };
|
||||
@@ -4989,7 +4989,7 @@ function testDocApi() {
|
||||
const forbiddenOrigin = 'http://evil.com';
|
||||
|
||||
// Normal same origin requests
|
||||
anonConfig.headers.Origin = allowedOrigin;
|
||||
anonConfig.headers!.Origin = allowedOrigin;
|
||||
let response: AxiosResponse;
|
||||
for (response of [
|
||||
await axios.post(url, data, anonConfig),
|
||||
@@ -5005,7 +5005,7 @@ function testDocApi() {
|
||||
|
||||
// Cross origin requests from untrusted origin.
|
||||
for (const config of [anonConfig, chimpyConfig]) {
|
||||
config.headers.Origin = forbiddenOrigin;
|
||||
config.headers!.Origin = forbiddenOrigin;
|
||||
for (response of [
|
||||
await axios.post(url, data, config),
|
||||
await axios.get(url, config),
|
||||
|
||||
@@ -28,6 +28,12 @@ describe('ManyFetches', function() {
|
||||
let docs: TestServer;
|
||||
let userApi: UserAPIImpl;
|
||||
|
||||
before(function () {
|
||||
if (!process.env.TEST_REDIS_URL) {
|
||||
return this.skip();
|
||||
}
|
||||
});
|
||||
|
||||
beforeEach(async function() {
|
||||
oldEnv = new EnvironmentSnapshot(); // Needed for prepareDatabase, which changes process.env
|
||||
log.info("Starting servers");
|
||||
|
||||
Reference in New Issue
Block a user