Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bye body-parser #752

Merged
merged 3 commits into from
Mar 12, 2024
Merged

Bye body-parser #752

merged 3 commits into from
Mar 12, 2024

Conversation

Yang-33
Copy link
Contributor

@Yang-33 Yang-33 commented Mar 11, 2024

body-parser#raw is no more necessary in line-bot-sdk-nodejs.

Resolve #749

If special line-bot-sdk-nodejs user depends on body-parser#raw, they can use body-parser like this. (I don't believe so)

import express from 'express';
import { middleware as lineMiddleware } from '@line/bot-sdk';
import bodyParser from 'body-parser';

const config = {
  channelAccessToken: process.env.LINE_CHANNEL_ACCESS_TOKEN || '',
  channelSecret: process.env.LINE_CHANNEL_SECRET || '',
};

const app = express();

// PLEASE ADD THIS IF NECESSARY
app.use(bodyParser.raw({
  type: '*/*'
}));

app.post('/webhook', lineMiddleware(config), (req, res) => {
  // your code
});

@Yang-33 Yang-33 changed the title Bye body parser Bye body-parser Mar 11, 2024
@Yang-33 Yang-33 marked this pull request as ready for review March 12, 2024 01:03
Copy link
Member

@tokuhirom tokuhirom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Yang-33 Yang-33 merged commit 05d9085 into line:master Mar 12, 2024
3 checks passed
@Yang-33 Yang-33 deleted the bye-body-parser branch March 12, 2024 04:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Drop body-parser dependency
2 participants