Registry /
http-networking / redux-shapeshifter-middleware
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
default
✓ import shapeshifter from 'redux-shapeshifter-middleware'
✗ const shapeshifter = require('redux-shapeshifter-middleware')
ESM default export; CJS require also works but typings may be lost.
shapeshifterMiddleware
✓ import shapeshifter from 'redux-shapeshifter-middleware'
✗ import { shapeshifterMiddleware } from 'redux-shapeshifter-middleware'
The package exports a single function as default. Named import does not exist.
createShapeshifter
✓ import shapeshifter from 'redux-shapeshifter-middleware'
✗ import { createShapeshifter } from 'redux-shapeshifter-middleware'
There is no named export. Use default import.
Demonstrates setting up the middleware with a base URL and auth config, then dispatching a GET request action with lifecycle types.
import { createStore, applyMiddleware } from 'redux';
import shapeshifter from 'redux-shapeshifter-middleware';
const apiMiddleware = shapeshifter({
base: 'https://api.example.com/',
auth: {
user: 'token'
},
fallbackToAxiosStatusResponse: true
});
const reducer = (state = {}) => state;
const store = createStore(reducer, applyMiddleware(apiMiddleware));
// Dispatch an API action
store.dispatch({
type: 'FETCH_USER',
types: ['FETCH_USER_PENDING', 'FETCH_USER_SUCCESS', 'FETCH_USER_ERROR'],
method: 'GET',
payload: {
url: '/users/123',
auth: true
}
});
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading 'types')
Action object does not have a 'types' array at the top level or in payload.
fixAdd a 'types' array to your action with three strings for pending, success, and error action types.
Uncaught (in promise) Error: shapeshifter middleware: payload object is undefined
Action payload is not defined or is undefined.
fixEnsure the action has a 'payload' property with at least a 'url' string.
Error: shapeshifter middleware: axios is not installed or not passable in config
Axios is not installed as a peer dependency.
fixRun 'npm install axios' or 'yarn add axios'.
Error: shapeshifter middleware: method must be a valid HTTP method string
Action 'method' property is missing or is an invalid HTTP method.
fixSet 'method' to one of: GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS.
Audit
Dependencies
axiosrequiredHTTP client for making AJAX requests