Loading
+2 −2
Original line number Diff line number Diff line
@@ -549,10 +549,10 @@ in the middleware, you can omit the function argument of `fedifyWith()`.
The `config` object is necessary to let Next.js know that the middleware
should process requests with the `Accept` header matching the federation
accept regex.  This is because Next.js middleware processes only requests
with the `Accept` header matching the regex by default.  More details can be
found in the [Next.js documentation](https://nextjs.org/docs/app/api-reference/file-conventions/middleware#config-object-optional).
with the `Accept` header matching the regex by default.  More details can be found in the Next.js official documentation [`config` in `middleware.js`].

[Next.js]: https://nextjs.org/
[`config` in `middleware.js`]: https://nextjs.org/docs/app/api-reference/file-conventions/middleware#config-object-optional


Custom middleware
+10 −14
Original line number Diff line number Diff line
@@ -77,13 +77,11 @@ type ErrorHandlers = Omit<FederationFetchOptions<unknown>, "contextData">;
 *
 * @template TContextData A type of the context data for the
 *                         {@link Federation} object.
 * @param {Federation<TContextData>} federation A {@link Federation} object
 *                         to integrate with Next.js.
 * @param {ContextDataFactory<TContextData>} contextDataFactory A function
 *                         to create a context data for the
 * @param federation A {@link Federation} object to integrate with Next.js.
 * @param contextDataFactory A function to create a context data for the
 *                         {@link Federation} object.
 * @param {Partial<ErrorHandlers>} errorHandlers A set of error handlers to
 *                         handle errors during the federation fetch.
 * @param errorHandlers A set of error handlers to handle errors during
 *                      the federation fetch.
 * @returns A Next.js middleware function to integrate with the
 *          {@link Federation} object.
 *
@@ -160,13 +158,11 @@ const FEDERATION_ACCEPT_REGEX =
 *
 * @template TContextData A type of the context data for the
 *                        {@link Federation} object.
 * @param {Federation<TContextData>} federation A {@link Federation} object
 *                         to integrate with Next.js.
 * @param {ContextDataFactory<TContextData>} contextDataFactory A function
 *                         to create a context data for the
 * @param federation A {@link Federation} object to integrate with Next.js.
 * @param contextDataFactory A function to create a context data for the
 *                           {@link Federation} object.
 * @param {Partial<ErrorHandlers>} errorHandlers A set of error handlers to
 *                         handle errors during the federation fetch.
 * @param errorHandlers A set of error handlers to handle errors during
 *                      the federation fetch.
 * @returns A Next.js handler.
 */
export function integrateFederation<TContextData>(