@@ -7,6 +7,7 @@ import com.apollographql.apollo.api.CustomScalarAdapters
7
7
import com.apollographql.apollo.api.Operation
8
8
import com.apollographql.apollo.api.Subscription
9
9
import com.apollographql.apollo.api.Upload
10
+ import com.apollographql.apollo.api.http.DefaultHttpRequestComposer.Companion.composePostParams
10
11
import com.apollographql.apollo.api.http.internal.urlEncode
11
12
import com.apollographql.apollo.api.json.JsonWriter
12
13
import com.apollographql.apollo.api.json.buildJsonByteString
@@ -32,14 +33,12 @@ import okio.buffer
32
33
*/
33
34
class DefaultHttpRequestComposer (
34
35
private val serverUrl : String ,
35
- private val acceptHeaderQueriesAndMutations : String = HEADER_ACCEPT_VALUE_QUERIES_AND_MUTATIONS_20220824 ,
36
- private val acceptHeaderSubscriptions : String = HEADER_ACCEPT_VALUE_SUBSCRIPTIONS_1_0 ,
36
+ private val acceptHeaderQueriesAndMutations : String = HEADER_ACCEPT_VALUE_QUERIES_AND_MUTATIONS ,
37
37
) : HttpRequestComposer {
38
38
39
39
constructor (serverUrl: String ) : this (
40
40
serverUrl = serverUrl,
41
- acceptHeaderQueriesAndMutations = HEADER_ACCEPT_VALUE_QUERIES_AND_MUTATIONS_20220824 ,
42
- acceptHeaderSubscriptions = HEADER_ACCEPT_VALUE_SUBSCRIPTIONS_1_0 ,
41
+ acceptHeaderQueriesAndMutations = HEADER_ACCEPT_VALUE_QUERIES_AND_MUTATIONS ,
43
42
)
44
43
45
44
override fun <D : Operation .Data > compose (apolloRequest : ApolloRequest <D >): HttpRequest {
@@ -48,7 +47,7 @@ class DefaultHttpRequestComposer(
48
47
49
48
val requestHeaders = mutableListOf<HttpHeader >().apply {
50
49
if (apolloRequest.operation is Subscription <* >) {
51
- add(HttpHeader (HEADER_ACCEPT_NAME , acceptHeaderSubscriptions ))
50
+ add(HttpHeader (HEADER_ACCEPT_NAME , HEADER_ACCEPT_VALUE_SUBSCRIPTIONS ))
52
51
} else {
53
52
add(HttpHeader (HEADER_ACCEPT_NAME , acceptHeaderQueriesAndMutations))
54
53
}
@@ -100,25 +99,11 @@ class DefaultHttpRequestComposer(
100
99
// and thus is safe to execute.
101
100
// See https://www.apollographql.com/docs/apollo-server/security/cors/#preventing-cross-site-request-forgery-csrf
102
101
// for details.
103
- internal val HEADER_APOLLO_REQUIRE_PREFLIGHT = " Apollo-Require-Preflight"
102
+ private const val HEADER_APOLLO_REQUIRE_PREFLIGHT = " Apollo-Require-Preflight"
104
103
105
- val HEADER_ACCEPT_NAME = " Accept"
106
-
107
- const val HEADER_ACCEPT_VALUE_QUERIES_AND_MUTATIONS_20220824 =
108
- " multipart/mixed;deferSpec=20220824, application/graphql-response+json, application/json"
109
-
110
- // TODO To be agreed upon with the router and other clients
111
- const val HEADER_ACCEPT_VALUE_QUERIES_AND_MUTATIONS_20230621 =
112
- " multipart/mixed;incrementalDeliverySpec=20230621, application/graphql-response+json, application/json"
113
-
114
- const val HEADER_ACCEPT_VALUE_SUBSCRIPTIONS_1_0 =
115
- " multipart/mixed;subscriptionSpec=1.0, application/graphql-response+json, application/json"
116
-
117
- @Deprecated(" Use HEADER_ACCEPT_VALUE_SUBSCRIPTIONS_1_0 instead" , ReplaceWith (" HEADER_ACCEPT_VALUE_SUBSCRIPTIONS_1_0" ))
118
- val HEADER_ACCEPT_VALUE_MULTIPART = HEADER_ACCEPT_VALUE_SUBSCRIPTIONS_1_0
119
-
120
- @Deprecated(" Use HEADER_ACCEPT_VALUE_QUERIES_AND_MUTATIONS_20220824 instead" , ReplaceWith (" HEADER_ACCEPT_VALUE_QUERIES_AND_MUTATIONS_20220824" ))
121
- val HEADER_ACCEPT_VALUE_DEFER = HEADER_ACCEPT_VALUE_QUERIES_AND_MUTATIONS_20220824
104
+ private const val HEADER_ACCEPT_NAME = " Accept"
105
+ private const val HEADER_ACCEPT_VALUE_QUERIES_AND_MUTATIONS = " multipart/mixed;deferSpec=20220824, application/graphql-response+json, application/json"
106
+ private const val HEADER_ACCEPT_VALUE_SUBSCRIPTIONS = " multipart/mixed;subscriptionSpec=1.0, application/graphql-response+json, application/json"
122
107
123
108
private fun <D : Operation .Data > buildGetUrl (
124
109
serverUrl : String ,
0 commit comments