Skip to content

Commit

Permalink
feat: export HttpRequestLike
Browse files Browse the repository at this point in the history
  • Loading branch information
angeloashmore committed May 13, 2021
1 parent 731a444 commit 96f1e1e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
11 changes: 1 addition & 10 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { getCookie } from './lib/getCookie'
import {
Document,
FetchLike,
HttpRequestLike,
LinkResolver,
Query,
Ref,
Expand All @@ -15,16 +16,6 @@ import { HTTPError } from './HTTPError'
import * as cookie from './cookie'
import * as predicate from './predicate'

/**
* The minimum required properties to treat as an HTTP Request for automatic Prismic preview support.
*/
interface HttpRequestLike {
headers?: {
cookie?: string
}
query?: Record<string, unknown>
}

/**
* A ref or a function that returns a ref. If a static ref is known, one can be given. If the ref must be fetched on-demand, a function can be provided. This function can optionally be asynchronous.
*/
Expand Down
10 changes: 10 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,13 @@ export interface ResponseLike {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
json(): Promise<any>
}

/**
* The minimum required properties to treat as an HTTP Request for automatic Prismic preview support.
*/
export interface HttpRequestLike {
headers?: {
cookie?: string
}
query?: Record<string, unknown>
}

0 comments on commit 96f1e1e

Please sign in to comment.