Skip to content

Commit 320b8e8

Browse files
authored
Make note about HTML-encoding Query Strings
Before, the examples of constructing a query string in this document were a combination of unencoded and encoded HTML strings. Now, the examples explicitly state that users should construct their query strings using the HTML-encoder of their choice.
1 parent af7d3eb commit 320b8e8

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

content/rest/reference/search.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,21 @@ Each endpoint in the Search API uses [query parameters](https://en.wikipedia.org
3535
A query can contain any combination of search qualifiers supported on GitHub.com. The format of the search query is:
3636

3737
```
38-
q=SEARCH_KEYWORD_1+SEARCH_KEYWORD_N+QUALIFIER_1+QUALIFIER_N
38+
SEARCH_KEYWORD_1 SEARCH_KEYWORD_N QUALIFIER_1 QUALIFIER_N
3939
```
4040

4141
For example, if you wanted to search for all _repositories_ owned by `defunkt` that
4242
contained the word `GitHub` and `Octocat` in the README file, you would use the
4343
following query with the _search repositories_ endpoint:
4444

4545
```
46-
q=GitHub+Octocat+in:readme+user:defunkt
46+
GitHub Octocat in:readme user:defunkt
47+
```
48+
49+
NOTE: Be sure to use your language's preferred HTML-encoder to construct your query strings. Example:
50+
```javascript
51+
// JavaScript
52+
const queryString = 'q=' + encodeURIComponent('GitHub Octocat in:readme user:defunkt');
4753
```
4854

4955
See "[Searching on GitHub](/articles/searching-on-github/)"

0 commit comments

Comments
 (0)