question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

example for request header

See original GitHub issue

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I’m always frustrated when […]

so my API is quite lots of required header for each request. also sometime response have headers too, but this topic is not fit for this thread i guess.

So far I search this repo’s example, n I did found how to make request header, luckily.

image

/**
     *
     * POST /board/write
     * @summary 게시판 작성 메소드.
     * @tags board
     * @param {string} x-lang.header.required - ko
     * @param {string} x-access-token.header.required - access토큰
     * @param {string} x-refresh-token.header.required - refresh토큰
     * @param {Req_board_write} request.body.required - song info
     * @return {testType} 200 - success response - application/json
     * @example request - payload example
     * {
     *   "seqUser" : 0,
     *   "boardTitle" : "Hello world",
     *   "boardContext" : "<h1>Hello world</h1>",
     *   "boardType" : 1
     * }
     */
<above image and code is what i did find out so far>

I guess you guys assume that my header’s are might be using all of my restAPI’s. yes, those headers are pretty much everywhere in my project.

and its so hard that I have to copy-paste every single try-out. its so painful.

therefore I expect @example for request header also.

Describe the solution you’d like A clear and concise description of what you want to happen.

add another annotation tag for request header example eg)

/**
     *
     * POST /board/write
     * @summary 게시판 작성 메소드.
     * @tags board
     * @param {string} x-lang.header.required - ko
     * @param {string} x-access-token.header.required - access토큰
     * @param {string} x-refresh-token.header.required - refresh토큰
     * @param {Req_board_write} request.body.required - song info
     * @return {testType} 200 - success response - application/json
     * @example request.body - payload example
     * {
     *   "seqUser" : 0,
     *   "boardTitle" : "Hello world",
     *   "boardContext" : "<h1>Hello world</h1>",
     *   "boardType" : 1
     * }
     * @example request.header - example headers
     * {
     *   "x-access-token" : "Foo",
     *   "x-refresh-token" : "Bar",
     *   "x-lang" : "Faz"
     * }
     */

Describe alternatives you’ve considered A clear and concise description of any alternative solutions or features you’ve considered.

or extends example for fillable header eg)

/**
     *
     * POST /board/write
     * @summary 게시판 작성 메소드.
     * @tags board
     * @param {string} x-lang.header.required - ko
     * @param {string} x-access-token.header.required - access토큰
     * @param {string} x-refresh-token.header.required - refresh토큰
     * @param {Req_board_write} request.body.required - song info
     * @return {testType} 200 - success response - application/json
     * @example request - payload example
     * {
     *  "header" : {
     *     "x-access-token" : "Foo",
     *     "x-refresh-token" : "Bar",
     *     "x-lang" : "Faz"
     *   }
     *   "body" : {
     *     "seqUser" : 0,
     *     "boardTitle" : "Hello world",
     *     "boardContext" : "<h1>Hello world</h1>",
     *     "boardType" : 1
     *   }
     * }
     */

Additional context Add any other context or screenshots about the feature request here. or maybe there is already reqeust header example, i dunno where to find. help me out will ya?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
kevinccbsgcommented, Oct 30, 2020

Hi @juicycool92,

Right now you can add headers for the request like this example as you mentioned in this issue. However, for responses we currently don’t have support for that with the comments but you can use our merge option. Maybe that can help you to solve your issue in the meantime.

For the response headers, there is already an issue and a discussion on the best way to create comments in this issue.

We will keep this issue to track the header’s examples feature progress. I don’t think there is a way to create those examples right now. 🤔 we will have a look. 👍

0reactions
kevinccbsgcommented, Nov 3, 2020

Thanks for adding the solution to this issue. 🎉

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTTP headers - MDN Web Docs - Mozilla
HTTP headers let the client and the server pass additional information with an HTTP request or response. An HTTP header consists of its ......
Read more >
HTTP Headers for Dummies - Code - Envato Tuts+
The first line is the "Request Line", which contains some basic information on the request. And the rest are the HTTP headers. ......
Read more >
HTTP - Header Fields - Tutorialspoint
General-header: These header fields have general applicability for both request and response messages. · Client Request-header: These header fields have ...
Read more >
HTTP headers - GeeksforGeeks
The HTTP headers are used to pass additional information between the clients and the server through the request and response header.
Read more >
List of HTTP header fields - Wikipedia
HTTP header fields are a list of strings sent and received by both the client program and server on every HTTP request and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found