Migrate from v6 to v7
With v7 the getServiceProxy and getDirectServiceProxy methods have been removed.
In order to upgrade to v7 you need to change the implementation using such methods to use another HTTP Client.
tip
Custom Plugin Lib already provides the getHttpClient method to build an axios-based HTTP client since v5.0.0.
Main breaking changes from the already existent getServiceProxy and getDirectServiceProxy:
- streams respond with an object with headers, payload and statusCode. The payload has the stream interface
allowedStatusCodesarray of status codes is replaced by the functionvalidateStatus(which accept by default 2xx)agentto configure the proxy is renamed toproxyand it is now an objectportandprotocolare now accepted only in url and baseUrl
Migrate getDirectServiceProxy
const proxy = fastify.getServiceProxy('my-service', {})
// becomes
const proxy = fastify.getHttpClient('http://microservice-gateway/', {})
Migrate getServiceProxy
const proxy = fastify.getServiceProxy('my-service', {})
// becomes
const proxy = fastify.getHttpClient('http://my-service/', {})