@sveltejs/adapter-netlify 2.0.5 → 2.0.7

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.
package/README.md CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  A SvelteKit adapter that creates a Netlify app.
4
4
 
5
- If you're using [adapter-auto](https://kit.svelte.dev/docs/adapter-auto), you don't need to install this unless you need to specify Netlify-specific options, since it's already included.
6
-
7
5
  ## Docs
8
6
 
9
7
  [Docs](https://kit.svelte.dev/docs/adapter-netlify)
@@ -14,11 +14,11 @@ import 'stream/web';
14
14
  import 'worker_threads';
15
15
  import 'perf_hooks';
16
16
  import 'util/types';
17
- import 'url';
18
17
  import 'events';
19
18
  import 'tls';
20
19
  import 'async_hooks';
21
20
  import 'console';
21
+ import 'url';
22
22
  import 'zlib';
23
23
  import 'string_decoder';
24
24
  import 'crypto';
@@ -119,24 +119,30 @@ function parse(input, options) {
119
119
  }
120
120
  }
121
121
 
122
- if (input.headers && input.headers["set-cookie"]) {
123
- // fast-path for node.js (which automatically normalizes header names to lower-case
124
- input = input.headers["set-cookie"];
125
- } else if (input.headers) {
126
- // slow-path for other environments - see #25
127
- var sch =
128
- input.headers[
129
- Object.keys(input.headers).find(function (key) {
130
- return key.toLowerCase() === "set-cookie";
131
- })
132
- ];
133
- // warn if called on a request-like object with a cookie header rather than a set-cookie header - see #34, 36
134
- if (!sch && input.headers.cookie && !options.silent) {
135
- console.warn(
136
- "Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."
137
- );
122
+ if (input.headers) {
123
+ if (typeof input.headers.getSetCookie === "function") {
124
+ // for fetch responses - they combine headers of the same type in the headers array,
125
+ // but getSetCookie returns an uncombined array
126
+ input = input.headers.getSetCookie();
127
+ } else if (input.headers["set-cookie"]) {
128
+ // fast-path for node.js (which automatically normalizes header names to lower-case
129
+ input = input.headers["set-cookie"];
130
+ } else {
131
+ // slow-path for other environments - see #25
132
+ var sch =
133
+ input.headers[
134
+ Object.keys(input.headers).find(function (key) {
135
+ return key.toLowerCase() === "set-cookie";
136
+ })
137
+ ];
138
+ // warn if called on a request-like object with a cookie header rather than a set-cookie header - see #34, 36
139
+ if (!sch && input.headers.cookie && !options.silent) {
140
+ console.warn(
141
+ "Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."
142
+ );
143
+ }
144
+ input = sch;
138
145
  }
139
- input = sch;
140
146
  }
141
147
  if (!Array.isArray(input)) {
142
148
  input = [input];