add fix for fever api for Unread (#1188)

This commit is contained in:
Athou
2024-01-14 18:27:16 +01:00
parent 18358d5991
commit d7b2c5a6e3
2 changed files with 12 additions and 16 deletions

View File

@@ -84,13 +84,6 @@ public class FeverREST {
private final FeedCategoryDAO feedCategoryDAO;
private final FeedEntryStatusDAO feedEntryStatusDAO;
@Path(PATH)
@GET
@Produces(MediaType.TEXT_PLAIN)
public String welcome() {
return "Welcome to the CommaFeed Fever API. Add this URL to your Fever-compatible reader.";
}
// expected Fever API
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Path(PATH)
@@ -116,6 +109,18 @@ public class FeverREST {
return handle(userId, params);
}
// workaround for some readers that use GET instead of POST
// e.g. Unread
@Path(PATH)
@GET
@UnitOfWork
@Timed
public FeverResponse get(@Context UriInfo uri, @PathParam("userId") Long userId) {
Map<String, String> params = new HashMap<>();
uri.getQueryParameters().forEach((k, v) -> params.put(k, v.get(0)));
return handle(userId, params);
}
// workaround for some readers that post data using MultiPart FormData instead of the classic POST
// e.g. Raven Reader
@Consumes(MediaType.MULTIPART_FORM_DATA)

View File

@@ -32,15 +32,6 @@ class FeverIT extends BaseIT {
this.userId = user.getId();
}
@Test
void get() {
String message = getClient().target(getApiBaseUrl() + "fever/user/${userId}")
.resolveTemplate("userId", 1)
.request()
.get(String.class);
Assertions.assertEquals("Welcome to the CommaFeed Fever API. Add this URL to your Fever-compatible reader.", message);
}
@Test
void invalidApiKey() {
FeverResponse response = fetch("feeds", "invalid-key");