tessl install tessl/npm-rest@2.0.0RESTful HTTP client library with composable interceptor architecture for Node.js and browsers
Agent Success
Agent success rate when using this tile
76%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.29x
Baseline
Agent success rate without this tile
59%
Build a utility that fetches and navigates HAL-formatted API resources using the rest.js HTTP client library.
Your implementation should provide a simple interface to:
HAL (Hypertext Application Language) responses contain _links for related resources and _embedded for nested data. Your utility should leverage the rest.js library's built-in HAL support to navigate these hypermedia structures.
_links containing a self link @test_links.orders, following the "orders" relationship fetches the related orders resource @test_embedded.author returns the author object without making an HTTP request @test@generates
/**
* Creates a HAL-aware HTTP client for the given base URL.
*
* @param {string} baseUrl - The base URL of the HAL API
* @returns {Object} Client with methods to fetch and navigate HAL resources
*/
function createHalClient(baseUrl) {}
/**
* Fetches a HAL+JSON resource from the specified path.
*
* @param {string} path - The path to fetch
* @returns {Promise<Object>} Promise resolving to the HAL resource with entity data
*/
// Method on the client returned from createHalClient
function fetch(path) {}
/**
* Follows a link relationship from the current resource to a related resource.
*
* @param {Object} response - The current HAL response object
* @param {string} rel - The link relationship name
* @returns {Promise<Object>} Promise resolving to the related resource
*/
// Method on the client returned from createHalClient
function follow(response, rel) {}
module.exports = { createHalClient };Provides RESTful HTTP client with HAL support for hypermedia navigation.
@satisfied-by