Fix Discord interactions endpoint with proper raw body handling
cgen-2c03539416fa4c19a10472b9201887b7
This commit is contained in:
parent
effce4ca87
commit
652cde8a81
1 changed files with 7 additions and 0 deletions
|
|
@ -8,6 +8,13 @@ import { randomUUID, createHash, createVerify } from "crypto";
|
|||
export function createServer() {
|
||||
const app = express();
|
||||
|
||||
// Middleware - capture raw body for Discord signature verification
|
||||
app.use((req, res, buf, encoding) => {
|
||||
if (buf && buf.length) {
|
||||
req.rawBody = buf.toString(encoding || 'utf8');
|
||||
}
|
||||
});
|
||||
|
||||
// Middleware
|
||||
app.use(cors());
|
||||
app.use(express.json());
|
||||
|
|
|
|||
Loading…
Reference in a new issue