From 965923116df99ad8533ffe7a28dc210e2da275ae Mon Sep 17 00:00:00 2001 From: Andrew Bastin Date: Mon, 10 Feb 2020 18:12:21 -0500 Subject: [PATCH 1/5] Added Common Headers to a separate file --- functions/headers.js | 124 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 functions/headers.js diff --git a/functions/headers.js b/functions/headers.js new file mode 100644 index 000000000..9fbc2938e --- /dev/null +++ b/functions/headers.js @@ -0,0 +1,124 @@ +export const commonHeaders = [ + "WWW-Authenticate", + "Authorization", + "Proxy-Authenticate", + "Proxy-Authorization", + "Age", + "Cache-Control", + "Clear-Site-Data", + "Expires", + "Pragma", + "Warning", + "Accept-CH", + "Accept-CH-Lifetime", + "Early-Data", + "Content-DPR", + "DPR", + "Device-Memory", + "Save-Data", + "Viewport-Width", + "Width", + "Last-Modified", + "ETag", + "If-Match", + "If-None-Match", + "If-Modified-Since", + "If-Unmodified-Since", + "Vary", + "Connection", + "Keep-Alive", + "Accept", + "Accept-Charset", + "Accept-Encoding", + "Accept-Language", + "Expect", + "Max-Forwards", + "Cookie", + "Set-Cookie", + "Cookie2", + "Set-Cookie2", + "Access-Control-Allow-Origin", + "Access-Control-Allow-Credentials", + "Access-Control-Allow-Headers", + "Access-Control-Allow-Methods", + "Access-Control-Expose-Headers", + "Access-Control-Max-Age", + "Access-Control-Request-Headers", + "Access-Control-Request-Method", + "Origin", + "Service-Worker-Allowed", + "Timing-Allow-Origin", + "X-Permitted-Cross-Domain-Policies", + "DNT", + "Tk", + "Content-Disposition", + "Content-Length", + "Content-Type", + "Content-Encoding", + "Content-Language", + "Content-Location", + "Forwarded", + "X-Forwarded-For", + "X-Forwarded-Host", + "X-Forwarded-Proto", + "Via", + "Location", + "From", + "Host", + "Referer", + "Referrer-Policy", + "User-Agent", + "Allow", + "Server", + "Accept-Ranges", + "Range", + "If-Range", + "Content-Range", + "Cross-Origin-Opener-Policy", + "Cross-Origin-Resource-Policy", + "Content-Security-Policy", + "Content-Security-Policy-Report-Only", + "Expect-CT", + "Feature-Policy", + "Public-Key-Pins", + "Public-Key-Pins-Report-Only", + "Strict-Transport-Security", + "Upgrade-Insecure-Requests", + "X-Content-Type-Options", + "X-Download-Options", + "X-Frame-Options", + "X-Powered-By", + "X-XSS-Protection", + "Last-Event-ID", + "NEL", + "Ping-From", + "Ping-To", + "Report-To", + "Transfer-Encoding", + "TE", + "Trailer", + "Sec-WebSocket-Key", + "Sec-WebSocket-Extensions", + "Sec-WebSocket-Accept", + "Sec-WebSocket-Protocol", + "Sec-WebSocket-Version", + "Accept-Push-Policy", + "Accept-Signature", + "Alt-Svc", + "Date", + "Large-Allocation", + "Link", + "Push-Policy", + "Retry-After", + "Signature", + "Signed-Headers", + "Server-Timing", + "SourceMap", + "Upgrade", + "X-DNS-Prefetch-Control", + "X-Firefox-Spdy", + "X-Pingback", + "X-Requested-With", + "X-Robots-Tag", + "X-UA-Compatible" +] From 6d463dcfef22f225c015b60e91583478d583080a Mon Sep 17 00:00:00 2001 From: Andrew Bastin Date: Mon, 10 Feb 2020 18:12:31 -0500 Subject: [PATCH 2/5] Updated commonHeaders definition to use the imported ones --- pages/graphql.vue | 126 +-------------------------------------------- pages/index.vue | 127 ++-------------------------------------------- 2 files changed, 5 insertions(+), 248 deletions(-) diff --git a/pages/graphql.vue b/pages/graphql.vue index f81d37145..6a7d1a48e 100644 --- a/pages/graphql.vue +++ b/pages/graphql.vue @@ -345,6 +345,7 @@ import axios from "axios"; import * as gql from "graphql"; import textareaAutoHeight from "../directives/textareaAutoHeight"; +import { commonHeaders } from "~/functions/headers"; import AceEditor from "../components/ace-editor"; import QueryEditor from "../components/graphql/queryeditor"; import { sendNetworkRequest } from "../functions/network"; @@ -364,130 +365,7 @@ export default { data() { return { schemaString: "", - commonHeaders: [ - "WWW-Authenticate", - "Authorization", - "Proxy-Authenticate", - "Proxy-Authorization", - "Age", - "Cache-Control", - "Clear-Site-Data", - "Expires", - "Pragma", - "Warning", - "Accept-CH", - "Accept-CH-Lifetime", - "Early-Data", - "Content-DPR", - "DPR", - "Device-Memory", - "Save-Data", - "Viewport-Width", - "Width", - "Last-Modified", - "ETag", - "If-Match", - "If-None-Match", - "If-Modified-Since", - "If-Unmodified-Since", - "Vary", - "Connection", - "Keep-Alive", - "Accept", - "Accept-Charset", - "Accept-Encoding", - "Accept-Language", - "Expect", - "Max-Forwards", - "Cookie", - "Set-Cookie", - "Cookie2", - "Set-Cookie2", - "Access-Control-Allow-Origin", - "Access-Control-Allow-Credentials", - "Access-Control-Allow-Headers", - "Access-Control-Allow-Methods", - "Access-Control-Expose-Headers", - "Access-Control-Max-Age", - "Access-Control-Request-Headers", - "Access-Control-Request-Method", - "Origin", - "Service-Worker-Allowed", - "Timing-Allow-Origin", - "X-Permitted-Cross-Domain-Policies", - "DNT", - "Tk", - "Content-Disposition", - "Content-Length", - "Content-Type", - "Content-Encoding", - "Content-Language", - "Content-Location", - "Forwarded", - "X-Forwarded-For", - "X-Forwarded-Host", - "X-Forwarded-Proto", - "Via", - "Location", - "From", - "Host", - "Referer", - "Referrer-Policy", - "User-Agent", - "Allow", - "Server", - "Accept-Ranges", - "Range", - "If-Range", - "Content-Range", - "Cross-Origin-Opener-Policy", - "Cross-Origin-Resource-Policy", - "Content-Security-Policy", - "Content-Security-Policy-Report-Only", - "Expect-CT", - "Feature-Policy", - "Public-Key-Pins", - "Public-Key-Pins-Report-Only", - "Strict-Transport-Security", - "Upgrade-Insecure-Requests", - "X-Content-Type-Options", - "X-Download-Options", - "X-Frame-Options", - "X-Powered-By", - "X-XSS-Protection", - "Last-Event-ID", - "NEL", - "Ping-From", - "Ping-To", - "Report-To", - "Transfer-Encoding", - "TE", - "Trailer", - "Sec-WebSocket-Key", - "Sec-WebSocket-Extensions", - "Sec-WebSocket-Accept", - "Sec-WebSocket-Protocol", - "Sec-WebSocket-Version", - "Accept-Push-Policy", - "Accept-Signature", - "Alt-Svc", - "Date", - "Large-Allocation", - "Link", - "Push-Policy", - "Retry-After", - "Signature", - "Signed-Headers", - "Server-Timing", - "SourceMap", - "Upgrade", - "X-DNS-Prefetch-Control", - "X-Firefox-Spdy", - "X-Pingback", - "X-Requested-With", - "X-Robots-Tag", - "X-UA-Compatible" - ], + commonHeaders: commonHeaders, queryFields: [], mutationFields: [], subscriptionFields: [], diff --git a/pages/index.vue b/pages/index.vue index aa9019f1a..1ddba72fc 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -1375,6 +1375,7 @@ import section from "../components/section"; import url from "url"; import querystring from "querystring"; +import { commonHeaders } from "~/functions/headers"; import textareaAutoHeight from "../directives/textareaAutoHeight"; import parseCurlCommand from "../assets/js/curlparser.js"; import getEnvironmentVariablesFromScript from "../functions/preRequest"; @@ -1497,130 +1498,8 @@ export default { "text/plain" ], - commonHeaders: [ - "WWW-Authenticate", - "Authorization", - "Proxy-Authenticate", - "Proxy-Authorization", - "Age", - "Cache-Control", - "Clear-Site-Data", - "Expires", - "Pragma", - "Warning", - "Accept-CH", - "Accept-CH-Lifetime", - "Early-Data", - "Content-DPR", - "DPR", - "Device-Memory", - "Save-Data", - "Viewport-Width", - "Width", - "Last-Modified", - "ETag", - "If-Match", - "If-None-Match", - "If-Modified-Since", - "If-Unmodified-Since", - "Vary", - "Connection", - "Keep-Alive", - "Accept", - "Accept-Charset", - "Accept-Encoding", - "Accept-Language", - "Expect", - "Max-Forwards", - "Cookie", - "Set-Cookie", - "Cookie2", - "Set-Cookie2", - "Access-Control-Allow-Origin", - "Access-Control-Allow-Credentials", - "Access-Control-Allow-Headers", - "Access-Control-Allow-Methods", - "Access-Control-Expose-Headers", - "Access-Control-Max-Age", - "Access-Control-Request-Headers", - "Access-Control-Request-Method", - "Origin", - "Service-Worker-Allowed", - "Timing-Allow-Origin", - "X-Permitted-Cross-Domain-Policies", - "DNT", - "Tk", - "Content-Disposition", - "Content-Length", - "Content-Type", - "Content-Encoding", - "Content-Language", - "Content-Location", - "Forwarded", - "X-Forwarded-For", - "X-Forwarded-Host", - "X-Forwarded-Proto", - "Via", - "Location", - "From", - "Host", - "Referer", - "Referrer-Policy", - "User-Agent", - "Allow", - "Server", - "Accept-Ranges", - "Range", - "If-Range", - "Content-Range", - "Cross-Origin-Opener-Policy", - "Cross-Origin-Resource-Policy", - "Content-Security-Policy", - "Content-Security-Policy-Report-Only", - "Expect-CT", - "Feature-Policy", - "Public-Key-Pins", - "Public-Key-Pins-Report-Only", - "Strict-Transport-Security", - "Upgrade-Insecure-Requests", - "X-Content-Type-Options", - "X-Download-Options", - "X-Frame-Options", - "X-Powered-By", - "X-XSS-Protection", - "Last-Event-ID", - "NEL", - "Ping-From", - "Ping-To", - "Report-To", - "Transfer-Encoding", - "TE", - "Trailer", - "Sec-WebSocket-Key", - "Sec-WebSocket-Extensions", - "Sec-WebSocket-Accept", - "Sec-WebSocket-Protocol", - "Sec-WebSocket-Version", - "Accept-Push-Policy", - "Accept-Signature", - "Alt-Svc", - "Date", - "Large-Allocation", - "Link", - "Push-Policy", - "Retry-After", - "Signature", - "Signed-Headers", - "Server-Timing", - "SourceMap", - "Upgrade", - "X-DNS-Prefetch-Control", - "X-Firefox-Spdy", - "X-Pingback", - "X-Requested-With", - "X-Robots-Tag", - "X-UA-Compatible" - ], + commonHeaders: commonHeaders, + showRequestModal: false, editRequest: {}, urlExcludes: {}, From 27da1c8e49bd57890d9e1615862585f31fc9a139 Mon Sep 17 00:00:00 2001 From: jamesgeorge007 Date: Tue, 11 Feb 2020 15:07:43 +0530 Subject: [PATCH 3/5] refactor: use relative imports --- pages/graphql.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/graphql.vue b/pages/graphql.vue index 6a7d1a48e..9a9c4b99f 100644 --- a/pages/graphql.vue +++ b/pages/graphql.vue @@ -345,7 +345,7 @@ import axios from "axios"; import * as gql from "graphql"; import textareaAutoHeight from "../directives/textareaAutoHeight"; -import { commonHeaders } from "~/functions/headers"; +import { commonHeaders } from "../functions/headers"; import AceEditor from "../components/ace-editor"; import QueryEditor from "../components/graphql/queryeditor"; import { sendNetworkRequest } from "../functions/network"; From f2f097bb7eb1563a0427e32c3c7157783f79cd7e Mon Sep 17 00:00:00 2001 From: jamesgeorge007 Date: Tue, 11 Feb 2020 15:09:07 +0530 Subject: [PATCH 4/5] refactor: use relative imports --- pages/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/index.vue b/pages/index.vue index 1ddba72fc..6e6fa0a1d 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -1375,7 +1375,7 @@ import section from "../components/section"; import url from "url"; import querystring from "querystring"; -import { commonHeaders } from "~/functions/headers"; +import { commonHeaders } from "../functions/headers"; import textareaAutoHeight from "../directives/textareaAutoHeight"; import parseCurlCommand from "../assets/js/curlparser.js"; import getEnvironmentVariablesFromScript from "../functions/preRequest"; From 9ecec8ce17fb825b31894cd6eecf08aba2bb3764 Mon Sep 17 00:00:00 2001 From: jamesgeorge007 Date: Tue, 11 Feb 2020 15:14:03 +0530 Subject: [PATCH 5/5] refactor: object shorthand --- pages/graphql.vue | 2 +- pages/index.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pages/graphql.vue b/pages/graphql.vue index 9a9c4b99f..417b66f87 100644 --- a/pages/graphql.vue +++ b/pages/graphql.vue @@ -365,7 +365,7 @@ export default { data() { return { schemaString: "", - commonHeaders: commonHeaders, + commonHeaders, queryFields: [], mutationFields: [], subscriptionFields: [], diff --git a/pages/index.vue b/pages/index.vue index 6e6fa0a1d..7d4c49514 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -1498,7 +1498,7 @@ export default { "text/plain" ], - commonHeaders: commonHeaders, + commonHeaders, showRequestModal: false, editRequest: {},