0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-03-31 23:31:30 -05:00
This commit is contained in:
Florian Lefebvre 2024-12-12 14:55:16 +01:00
parent b79a6b0505
commit aeec14ae89
3 changed files with 11 additions and 9 deletions

View file

@ -85,13 +85,13 @@ export function vitePluginActions({
code += `\nexport * from 'astro/actions/runtime/virtual/server.js';`;
} else {
code += `\nexport * from 'astro/actions/runtime/virtual/client.js';`;
code = code.replace(
"'/** @TRAILING_SLASH@ **/'",
JSON.stringify(
shouldAppendForwardSlash(settings.config.trailingSlash, settings.config.build.format),
),
);
}
code = code.replace(
"'/** @TRAILING_SLASH@ **/'",
JSON.stringify(
shouldAppendForwardSlash(settings.config.trailingSlash, settings.config.build.format),
),
);
return code;
},
};

View file

@ -1,8 +1,9 @@
import {
ActionError,
ACTION_QUERY_PARAMS,
appendForwardSlash,
deserializeActionResult,
getActionQueryString,
appendForwardSlash,
} from 'astro:actions';
const ENCODED_DOT = '%2E';

View file

@ -593,14 +593,15 @@ it('getActionPath() should return the right path', async () => {
root: './fixtures/actions/',
adapter: testAdapter(),
base: '/base',
trailingSlash: 'always',
});
const devServer = await fixture.startDevServer();
const res = await fixture.fetch('/base/get-action-path');
const res = await fixture.fetch('/base/get-action-path/');
assert.equal(res.ok, true);
const html = await res.text();
let $ = cheerio.load(html);
assert.equal($('[data-path]').text(), '/base/_actions/transformFormInput');
assert.equal($('[data-path]').text(), '/base/_actions/transformFormInput/');
await devServer.stop();
});