Skip to content

Commit 4f24a76

Browse files
fix(lapis-docs): mention how arrays must be supplied in form urlencoded requests (#1128)
resolves #1089
1 parent 64651ad commit 4f24a76

File tree

5 files changed

+6
-4
lines changed

5 files changed

+6
-4
lines changed

.idea/runConfigurations/LapisOpen.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lapis-docs/src/content/docs/concepts/request-methods.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ Check out the [fields](../references/fields) and [filters](../references/filters
6464
LAPIS also supports [URL encoded form data](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST) for POST requests.
6565
The content type must be set to `application/x-www-form-urlencoded` and the query must be encoded as a query string.
6666

67+
Note that arrays must be passed as repeated keys, e.g. `fields=country&fields=date`.
68+
6769
:::tip
6870
This is useful if you want to send the query directly from a HTML form.
6971
If `<form>` element has the `method` attribute set to `POST`

lapis-e2e/test/aggregated.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ describe('The /aggregated endpoint', () => {
124124

125125
expect(result.status).equals(400);
126126
const resultJson = await result.json();
127-
expect(resultJson.error.detail).to.include('Unknown field: notAField, known values are [primaryKey,');
127+
expect(resultJson.error.detail).to.include("Unknown field: 'notAField', known values are [primaryKey,");
128128
});
129129

130130
it('should return bad request for invalid variant query', async () => {

lapis/src/main/kotlin/org/genspectrum/lapis/request/Field.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class FieldConverter(
1414
fun convert(source: String): Field {
1515
val cleaned = caseInsensitiveFieldsCleaner.clean(source)
1616
?: throw BadRequestException(
17-
"Unknown field: $source, known values are ${caseInsensitiveFieldsCleaner.getKnownFields()}",
17+
"Unknown field: '$source', known values are ${caseInsensitiveFieldsCleaner.getKnownFields()}",
1818
)
1919

2020
return Field(cleaned)

lapis/src/test/kotlin/org/genspectrum/lapis/controller/LapisControllerCommonFieldsTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ class LapisControllerCommonFieldsTest(
445445
.andExpect(
446446
jsonPath(
447447
"\$.error.detail",
448-
).value(Matchers.containsString("Unknown field: nonExistingField, known values are [primaryKey,")),
448+
).value(Matchers.containsString("Unknown field: 'nonExistingField', known values are [primaryKey,")),
449449
)
450450
}
451451

0 commit comments

Comments
 (0)