forked from Archives/Athou_commafeed
add fix for fever api for Unread (#1188)
This commit is contained in:
@@ -84,13 +84,6 @@ public class FeverREST {
|
|||||||
private final FeedCategoryDAO feedCategoryDAO;
|
private final FeedCategoryDAO feedCategoryDAO;
|
||||||
private final FeedEntryStatusDAO feedEntryStatusDAO;
|
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
|
// expected Fever API
|
||||||
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
|
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
|
||||||
@Path(PATH)
|
@Path(PATH)
|
||||||
@@ -116,6 +109,18 @@ public class FeverREST {
|
|||||||
return handle(userId, params);
|
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
|
// workaround for some readers that post data using MultiPart FormData instead of the classic POST
|
||||||
// e.g. Raven Reader
|
// e.g. Raven Reader
|
||||||
@Consumes(MediaType.MULTIPART_FORM_DATA)
|
@Consumes(MediaType.MULTIPART_FORM_DATA)
|
||||||
|
|||||||
@@ -32,15 +32,6 @@ class FeverIT extends BaseIT {
|
|||||||
this.userId = user.getId();
|
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
|
@Test
|
||||||
void invalidApiKey() {
|
void invalidApiKey() {
|
||||||
FeverResponse response = fetch("feeds", "invalid-key");
|
FeverResponse response = fetch("feeds", "invalid-key");
|
||||||
|
|||||||
Reference in New Issue
Block a user