Skip to content

Commit

Permalink
Add autocompletion for headers value (#1142)
Browse files Browse the repository at this point in the history
* feature: add autocompletion for headers value

* chore: rename file to autocompleteConstants and move it to codemirror utils
  • Loading branch information
GuillaumeOnepilot authored Jul 4, 2024
1 parent 0d3765a commit 0d20469
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { saveCollectionRoot } from 'providers/ReduxStore/slices/collections/acti
import SingleLineEditor from 'components/SingleLineEditor';
import StyledWrapper from './StyledWrapper';
import { headers as StandardHTTPHeaders } from 'know-your-http-well';
import { MimeTypes } from 'utils/codemirror/autocompleteConstants';
const headerAutoCompleteList = StandardHTTPHeaders.map((e) => e.header);

const Headers = ({ collection }) => {
Expand Down Expand Up @@ -117,6 +118,7 @@ const Headers = ({ collection }) => {
)
}
collection={collection}
autocomplete={MimeTypes}
/>
</td>
<td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { sendRequest, saveRequest } from 'providers/ReduxStore/slices/collection
import SingleLineEditor from 'components/SingleLineEditor';
import StyledWrapper from './StyledWrapper';
import { headers as StandardHTTPHeaders } from 'know-your-http-well';
import { MimeTypes } from 'utils/codemirror/autocompleteConstants';
const headerAutoCompleteList = StandardHTTPHeaders.map((e) => e.header);

const RequestHeaders = ({ item, collection }) => {
Expand Down Expand Up @@ -115,6 +116,7 @@ const RequestHeaders = ({ item, collection }) => {
)
}
onRun={handleRun}
autocomplete={MimeTypes}
allowNewlines={true}
collection={collection}
/>
Expand Down
56 changes: 56 additions & 0 deletions packages/bruno-app/src/utils/codemirror/autocompleteConstants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
export const MimeTypes = [
'application/atom+xml',
'application/ecmascript',
'application/json',
'application/vnd.api+json',
'application/javascript',
'application/octet-stream',
'application/ogg',
'application/pdf',
'application/postscript',
'application/rdf+xml',
'application/rss+xml',
'application/soap+xml',
'application/font-woff',
'application/x-yaml',
'application/xhtml+xml',
'application/xml',
'application/xml-dtd',
'application/xop+xml',
'application/zip',
'application/gzip',
'application/graphql',
'application/x-www-form-urlencoded',
'audio/basic',
'audio/L24',
'audio/mp4',
'audio/mpeg',
'audio/ogg',
'audio/vorbis',
'audio/vnd.rn-realaudio',
'audio/vnd.wave',
'audio/webm',
'image/gif',
'image/jpeg',
'image/pjpeg',
'image/png',
'image/svg+xml',
'image/tiff',
'message/http',
'message/imdn+xml',
'message/partial',
'message/rfc822',
'multipart/mixed',
'multipart/alternative',
'multipart/related',
'multipart/form-data',
'multipart/signed',
'multipart/encrypted',
'text/cmd',
'text/css',
'text/csv',
'text/html',
'text/plain',
'text/vcard',
'text/xml'
];

0 comments on commit 0d20469

Please sign in to comment.