Skip to content

Commit

Permalink
refactor: rec accept value to gqlhttp lib
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonkuhrt committed Sep 5, 2024
1 parent 451204b commit bb48aee
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
9 changes: 2 additions & 7 deletions src/layers/5_core/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,8 @@ import type { DocumentNode, ExecutionResult, GraphQLSchema } from 'graphql'
import { print } from 'graphql'
import { Anyware } from '../../lib/anyware/__.js'
import { type StandardScalarVariables } from '../../lib/graphql.js'
import { parseExecutionResult } from '../../lib/graphqlHTTP.js'
import {
CONTENT_TYPE_GQL,
CONTENT_TYPE_GQL_OVER_HTTP_REC,
CONTENT_TYPE_JSON,
mergeHeadersInit,
} from '../../lib/http.js'
import { CONTENT_TYPE_GQL_OVER_HTTP_REC, parseExecutionResult } from '../../lib/graphqlHTTP.js'
import { CONTENT_TYPE_JSON, mergeHeadersInit } from '../../lib/http.js'
import { casesExhausted } from '../../lib/prelude.js'
import { execute } from '../0_functions/execute.js'
import type { Schema } from '../1_Schema/__.js'
Expand Down
6 changes: 6 additions & 0 deletions src/lib/graphqlHTTP.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { GraphQLFormattedError } from 'graphql'
import { type ExecutionResult, GraphQLError } from 'graphql'
import type { StandardScalarVariables } from './graphql.js'
import { CONTENT_TYPE_GQL, CONTENT_TYPE_JSON } from './http.js'
import { isPlainObject } from './prelude.js'

export type ExecutionInput = {
Expand Down Expand Up @@ -51,3 +52,8 @@ export const parseExecutionResult = (result: unknown): ExecutionResult => {
extensions,
}
}

/**
* @see https://graphql.github.io/graphql-over-http/draft/#sec-Legacy-Watershed
*/
export const CONTENT_TYPE_GQL_OVER_HTTP_REC = `${CONTENT_TYPE_GQL}; charset=utf-8, ${CONTENT_TYPE_JSON}; charset=utf-8`
5 changes: 1 addition & 4 deletions src/lib/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ export const ACCEPT_HEADER = `Accept`
export const CONTENT_TYPE_HEADER = `Content-Type`
export const CONTENT_TYPE_JSON = `application/json`
export const CONTENT_TYPE_GQL = `application/graphql-response+json`
/**
* @see https://graphql.github.io/graphql-over-http/draft/#sec-Legacy-Watershed
*/
export const CONTENT_TYPE_GQL_OVER_HTTP_REC = `${CONTENT_TYPE_GQL}; charset=utf-8, ${CONTENT_TYPE_JSON}; charset=utf-8`

export const statusCodes = {
success: 200,
}
Expand Down

0 comments on commit bb48aee

Please sign in to comment.