Post request for refined searches
This commit is contained in:
@@ -49,11 +49,23 @@ final class USDATests: XCTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
func testFoodSearch() async throws {
|
||||
func testGetFoodSearch() async throws {
|
||||
let fdc = USDA_FDC_Client()
|
||||
fdc.apiKey = env["API_KEY"] ?? ""
|
||||
do {
|
||||
let _ = try await fdc.getFoodsSearch(.init(query: "cheddar cheese"))
|
||||
let _ = try await fdc.searchFoods(.init(query: "cheddar cheese"))
|
||||
} catch {
|
||||
throw error
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func testPostFoodSearch() async throws {
|
||||
let fdc = USDA_FDC_Client()
|
||||
fdc.apiKey = env["API_KEY"] ?? ""
|
||||
do {
|
||||
let res = try await fdc.searchFoods(.init(query: "037600106214", dataType: [.Branded]), httpMethod: .POST)
|
||||
print(res)
|
||||
} catch {
|
||||
throw error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user