Ability to set custom headers
Added return value to hook
function passed in configuration object. From now on, this function can return Map
containing custom headers that will be set before sending response with open-graph image to client.
Example code:
import { withOGImage } from 'next-api-og-image'
export default withOGImage({
template: {
react: ({ myQueryParam }) => <div>🔥 {myQueryParam}</div>,
},
hook: () => {
const headers = new Map()
headers.set('X-My-Header', 'cool-thing')
return headers
},
})
Full Changelog: 4.1.0...4.2.0