mirror of
https://github.com/searxng/searxng.git
synced 2026-08-03 22:01:25 +00:00
[fix] autocomplete: drop POST method
This commit is contained in:
@@ -5,13 +5,7 @@ import { assertElement } from "../util/assertElement.ts";
|
|||||||
|
|
||||||
const fetchResults = async (qInput: HTMLInputElement, query: string): Promise<void> => {
|
const fetchResults = async (qInput: HTMLInputElement, query: string): Promise<void> => {
|
||||||
try {
|
try {
|
||||||
let res: Response;
|
const res = await http("GET", `./autocompleter?q=${query}`);
|
||||||
|
|
||||||
if (settings.method === "GET") {
|
|
||||||
res = await http("GET", `./autocompleter?q=${query}`);
|
|
||||||
} else {
|
|
||||||
res = await http("POST", "./autocompleter", { body: new URLSearchParams({ q: query }) });
|
|
||||||
}
|
|
||||||
|
|
||||||
const results = await res.json();
|
const results = await res.json();
|
||||||
|
|
||||||
|
|||||||
@@ -13,9 +13,9 @@
|
|||||||
</Url>
|
</Url>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if autocomplete %}
|
{% if autocomplete %}
|
||||||
<Url rel="suggestions" type="application/x-suggestions+json" method="{{ opensearch_method }}" template="{{ url_for('autocompleter', _external=True) }}?q={searchTerms}"/>
|
<Url rel="suggestions" type="application/x-suggestions+json" method="GET" template="{{ url_for('autocompleter', _external=True) }}?q={searchTerms}"/>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<Url rel="self" type="application/opensearchdescription+xml" method="{{ opensearch_method }}" template="{{ url_for('opensearch', _external=True) }}" />
|
<Url rel="self" type="application/opensearchdescription+xml" template="{{ url_for('opensearch', _external=True) }}" />
|
||||||
<Query role="example" searchTerms="SearXNG" />
|
<Query role="example" searchTerms="SearXNG" />
|
||||||
<moz:SearchForm>{{ url_for('search', _external=True) }}</moz:SearchForm>
|
<moz:SearchForm>{{ url_for('search', _external=True) }}</moz:SearchForm>
|
||||||
</OpenSearchDescription>
|
</OpenSearchDescription>
|
||||||
|
|||||||
@@ -803,7 +803,7 @@ def info(pagename, locale):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@app.route('/autocompleter', methods=['GET', 'POST'])
|
@app.route('/autocompleter', methods=['GET'])
|
||||||
def autocompleter():
|
def autocompleter():
|
||||||
"""Return autocompleter results"""
|
"""Return autocompleter results"""
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user