8000 Use correct JSON Mimetype · tableau/server-client-python@1c802ee · GitHub
[go: up one dir, main page]

Skip to content

Commit 1c802ee

Browse files
committed
Use correct JSON Mimetype
The official MIME type for JSON is `application/json`, not `text/json`.
1 parent b0e9abf commit 1c802ee

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tableauserverclient/server/endpoint/metadata_endpoint.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def query(self, query, variables=None, abort_on_error=False):
6767
raise InvalidGraphQLQuery("Must provide a string")
6868

6969
# Setting content type because post_reuqest defaults to text/xml
70-
server_response = self.post_request(url, graphql_query, content_type="text/json")
70+
server_response = self.post_request(url, graphql_query, content_type="application/json")
7171
results = server_response.json()
7272

7373
if abort_on_error and results.get("errors", None):
@@ -112,7 +112,7 @@ def paginated_query(self, query, variables=None, abort_on_error=False):
112112
paginated_results = results_dict["pages"]
113113

114114
# get first page
115-
server_response = self.post_request(url, graphql_query, content_type="text/json")
115+
server_response = self.post_request(url, graphql_query, content_type="application/json")
116116
results = server_response.json()
117117

118118
if abort_on_error and results.get("errors", None):
@@ -129,7 +129,7 @@ def paginated_query(self, query, variables=None, abort_on_error=False):
129129
# make the call
130130
logger.debug("Calling Token: " + cursor)
131131
graphql_query = json.dumps({"query": query, "variables": variables})
132-
server_response = self.post_request(url, graphql_query, content_type="text/json")
132+
server_response = self.post_request(url, graphql_query, content_type="application/json")
133133
results = server_response.json()
134134
# verify response
135135
if abort_on_error and results.get("errors", None):

0 commit comments

Comments
 (0)
0