GraphQL autocomplete and duplicate request

This commit is contained in:
Gregory Schier
2023-03-21 23:54:45 -07:00
parent 9b8961c23d
commit 168dfb9f6b
31 changed files with 299 additions and 157 deletions

View File

@@ -39,17 +39,21 @@ const headerOptionsMap: Record<string, string[]> = {
const valueAutocomplete = (headerName: string): GenericCompletionConfig | undefined => {
const name = headerName.toLowerCase().trim();
const options: GenericCompletionConfig['options'] =
headerOptionsMap[name]?.map((o, i) => ({
headerOptionsMap[name]?.map((o) => ({
label: o,
type: 'constant',
boost: 99 - i, // Max boost is 99
boost: 1, // Put above other completions
})) ?? [];
return { minMatch: MIN_MATCH, options };
};
const nameAutocomplete: PairEditorProps['nameAutocomplete'] = {
minMatch: MIN_MATCH,
options: headerNames.map((t, i) => ({ label: t, type: 'constant', boost: 99 - i })),
options: headerNames.map((t) => ({
label: t,
type: 'constant',
boost: 1, // Put above other completions
})),
};
const validateHttpHeader = (v: string) => {