api requests work, added simple tests... TODO: URL Object needs to be cloned for memory safety
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { requestJSON } from "@root/structures/apiRequest.ts";
|
||||
import { handlePostRequest } from "@root/plugins/yandere/api/post.ts";
|
||||
const baseURL = "https://yande.re";
|
||||
|
||||
const apikeys = [
|
||||
@@ -52,6 +52,17 @@ function prepareURLObjectForRequest(type: APIKeys) {
|
||||
|
||||
export function getPosts(search? : string){
|
||||
const url = prepareURLObjectForRequest("post")
|
||||
return requestJSON(url)
|
||||
return handlePostRequest(url, search)
|
||||
}
|
||||
|
||||
Deno.test("Empty Post Request", async() => {
|
||||
console.debug(await getPosts())
|
||||
})
|
||||
|
||||
Deno.test("Post Request with tag", async() => {
|
||||
console.debug(await getPosts("[tags:love_live!_(series)]"))
|
||||
})
|
||||
|
||||
Deno.test("Post Request with limit", async() => {
|
||||
console.debug(await getPosts("[limit: 1)]"))
|
||||
})
|
||||
Reference in New Issue
Block a user