Skip to content

Instantly share code, notes, and snippets.

View mkheck's full-sized avatar
💭
Coding, of course!

Mark Heckler mkheck

💭
Coding, of course!
View GitHub Profile
>> http :8080/test content-type:text/plain
HTTP/1.1 200
Content-Length: 27
Content-Type: text/plain;charset=UTF-8
Date: Thu, 08 Jun 2017 15:46:30 GMT
X-Application-Context: application
This is a test, using text.
http --json :8080/test
HTTP/1.1 200
Content-Type: application/json;charset=UTF-8
Date: Thu, 08 Jun 2017 15:47:22 GMT
Transfer-Encoding: chunked
X-Application-Context: application
{
"testKey": "testValue"
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>build-info</goal>
</goals>
humbert :: ~ » http :8080
HTTP/1.1 200
Content-Type: application/json;charset=UTF-8
Date: Wed, 21 Jun 2017 07:42:27 GMT
Transfer-Encoding: chunked
{
"myKey": "myValue"
}
humbert :: ~ » http :8080 'Accept:application/xml'
HTTP/1.1 200
Content-Type: application/xml;charset=UTF-8
Date: Wed, 21 Jun 2017 07:42:36 GMT
Transfer-Encoding: chunked
<Map><myKey>myValue</myKey></Map>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
</dependency>
dependencies {
compile('org.springframework.cloud:spring-cloud-starter-sleuth')
compile('org.springframework.boot:spring-boot-starter-web')
compileOnly('org.projectlombok:lombok')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
package com.example.szconsumerservice;
import lombok.extern.java.Log;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestOperations;
import org.springframework.web.client.RestTemplate;