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.

custom reason message for 200

See original GitHub issue

I’m using springfox 2.7 with spring mvc. its working fine except below problem: I want to return a string in one rest service. I can set reason for 400,401, 500 response codes. but I can not show a reason for 200 status code.I dont want return “OK” message. in the “Response Class (Status 200)” section I will get “string” message always:

Response Class (Status 200) string

I’m using following code :

 @ApiResponses(value = {
            @ApiResponse(code = 200, message = "my message 200", response = String.class),
            @ApiResponse(code = 400, message = "my message 400.", response = String.class),
            @ApiResponse(code = 500, message = "Failure", response = String.class),
    })

While if i use a custom pojo class instead of String.class, I can see “my message 200” in the “Response Class (Status 200)” section:

@ApiResponse(code = 200, message = "my message 200", response = SamplePojo.class)

Response Class (Status 200) my message 200

what is the problem? thanks

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
dilipkrishcommented, Jul 9, 2020

@paulosales thank you!

0reactions
dilipkrishcommented, Jul 9, 2020

Closing as not reproducable.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Express 4.14 - How to send 200 status with a custom message?
You can use: res.status(200).send('some text');. if you want to pass number to the send method, convert it to string first to avoid deprecation ......
Read more >
How to set a custom health check 200 response code
Cause : A server should only be passing health checks when a specific 200 response code is received. Resolution: Set the Real Server...
Read more >
HTTP/1.1: Response
The reason phrases listed here are only recommendations -- they MAY be replaced by local equivalents without affecting the protocol. Status-Code = "100"...
Read more >
How to Return HTTP Status Codes in a Spring Boot Application
Return HTTP Status Codes in Spring Boot​​ If the request went through just fine, a 200 OK is returned, while a 404 Not...
Read more >
HTTP Status Codes for Beginners | Alone On A Hill
The 200 status code is by far the most common returned. It means, simply, that the request was received and understood and is...
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