Skip to content

Commit

Permalink
feat(api): api update (#2210)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and meorphis committed Jan 13, 2025
1 parent b967654 commit cb517eb
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 1448
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-58466f8887cb79ea28006b477268bfeceb49aca0ef6b5907ebd6a779543da4ae.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-c6de93f8f17d32aab783331839a3d62613deee459b821a7a76cb0f4e73a038ce.yml
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,13 @@ export namespace ScriptUpdateParams {
* is no Worker script.
*/
not_found_handling?: 'none' | '404-page' | 'single-page-application';

/**
* When true and the incoming request matches an asset, that will be served instead
* of invoking the Worker script. When false, requests will always invoke the
* Worker script.
*/
serve_directly?: boolean;
}
}

Expand Down
7 changes: 7 additions & 0 deletions src/resources/workers/scripts/scripts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,13 @@ export namespace ScriptUpdateParams {
* is no Worker script.
*/
not_found_handling?: 'none' | '404-page' | 'single-page-application';

/**
* When true and the incoming request matches an asset, that will be served instead
* of invoking the Worker script. When false, requests will always invoke the
* Worker script.
*/
serve_directly?: boolean;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ describe('resource scripts', () => {
'<any part name>': [await toFile(Buffer.from('# my file contents'), 'README.md')],
metadata: {
assets: {
config: { html_handling: 'auto-trailing-slash', not_found_handling: 'none' },
config: {
html_handling: 'auto-trailing-slash',
not_found_handling: 'none',
serve_directly: true,
},
jwt: 'jwt',
},
bindings: [{ name: 'MY_ENV_VAR', type: 'plain_text' }],
Expand Down
5 changes: 4 additions & 1 deletion tests/api-resources/workers/scripts/scripts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ describe('resource scripts', () => {
rollback_to: 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415',
'<any part name>': [await toFile(Buffer.from('# my file contents'), 'README.md')],
metadata: {
assets: { config: { html_handling: 'auto-trailing-slash', not_found_handling: 'none' }, jwt: 'jwt' },
assets: {
config: { html_handling: 'auto-trailing-slash', not_found_handling: 'none', serve_directly: true },
jwt: 'jwt',
},
bindings: [{ name: 'MY_ENV_VAR', type: 'plain_text' }],
body_part: 'worker.js',
compatibility_date: '2023-07-25',
Expand Down

0 comments on commit cb517eb

Please sign in to comment.