File tree Expand file tree Collapse file tree 1 file changed +1
-10
lines changed Expand file tree Collapse file tree 1 file changed +1
-10
lines changed Original file line number Diff line number Diff line change 4
4
5
5
import querystring from "query-string" ;
6
6
import { revalidateTag } from "next/cache" ;
7
- import { headers } from "next/headers" ;
8
7
9
8
import type {
10
9
Post ,
@@ -28,7 +27,6 @@ interface FetchOptions {
28
27
revalidate ?: number | false ;
29
28
tags ?: string [ ] ;
30
29
} ;
31
- headers ?: HeadersInit ;
32
30
}
33
31
34
32
function getUrl ( path : string , query ?: Record < string , any > ) {
@@ -42,10 +40,6 @@ const defaultFetchOptions: FetchOptions = {
42
40
tags : [ "wordpress" ] ,
43
41
revalidate : 3600 , // Revalidate every hour by default
44
42
} ,
45
- headers : {
46
- Accept : "application/json" ,
47
- "Content-Type" : "application/json" ,
48
- } ,
49
43
} ;
50
44
51
45
// Error handling utility
@@ -61,16 +55,13 @@ async function wordpressFetch<T>(
61
55
url : string ,
62
56
options : FetchOptions = { }
63
57
) : Promise < T > {
64
- const headersList = await headers ( ) ;
65
- const userAgent = headersList . get ( "user-agent" ) || "Next.js WordPress Client" ;
58
+ const userAgent = "Next.js WordPress Client" ;
66
59
67
60
const response = await fetch ( url , {
68
61
...defaultFetchOptions ,
69
62
...options ,
70
63
headers : {
71
- ...defaultFetchOptions . headers ,
72
64
"User-Agent" : userAgent ,
73
- ...options . headers ,
74
65
} ,
75
66
} ) ;
76
67
You can’t perform that action at this time.
0 commit comments