@isomorph.ai/app-sdk 1.12.0 → 1.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +7 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -189,7 +189,13 @@ class Transport {
189
189
  const response = await this.fetch(`${this.baseUrl}${path}`, {
190
190
  credentials: 'same-origin',
191
191
  ...init,
192
- headers: mergeHeaders({ 'content-type': 'application/json' }, runnerIdentityHeaders(this.identity), init.headers, onProgress ? { accept: PROGRESS_MEDIA_TYPE } : undefined),
192
+ headers: mergeHeaders(
193
+ // No content type on a request without a body: a browser GET that
194
+ // carries one is not a "simple" request, so it costs a CORS preflight
195
+ // (OPTIONS, one more round trip, on a separate uncredentialed
196
+ // connection a preconnect cannot warm) before the GET itself. Without
197
+ // it the identity GET and every other read is one round trip.
198
+ init.body === undefined && ['GET', 'HEAD'].includes((init.method ?? 'GET').toUpperCase()) ? {} : { 'content-type': 'application/json' }, runnerIdentityHeaders(this.identity), init.headers, onProgress ? { accept: PROGRESS_MEDIA_TYPE } : undefined),
193
199
  });
194
200
  if (onProgress && response.ok && response.body && response.headers.get('content-type')?.startsWith(PROGRESS_MEDIA_TYPE)) {
195
201
  return readProgress(response, onProgress);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@isomorph.ai/app-sdk",
3
- "version": "1.12.0",
3
+ "version": "1.12.1",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",