1

I'm sending an object from the backend. The problem is that payload is a byte[] and it seems like spring converts it to String64.

I'm getting a strange output in the frontend so I tried to convert it to normal string and I get

 _co.atob is not a function

How do I convert this??

Backend

    @GetMapping("docker/container/{containerName}/logs")
public List<Frame> getContainerLogs(@PathVariable String containerName) {
    Container container = dockerService.getContainer(containerName);
    return dockerService.getDockerLogs(container);
}

frontend

ts:

getLogs() {
this.dockerService.getLogs(this.name).subscribe(logs => {
  this.logs = logs;
  console.log(logs);
});

html:

   <p *ngFor="let log of logs; let idx = index;"><span class="logsLine">{{idx}}: </span>

        <span>{{atob(log.payload)}}</span>
      </p>

example

{"streamType":"STDERR","payload":"JUdUTS1JLU1VRklMUk5EV05TVUMsIEZpbGUgL3Y3NTRxYWJhc2VfZ3RtbHgvZ2Jscy9tdW1wcy50YmxzIHN1Y2Nlc3NmdWxseSBydW5kb3duCg=="}
sdfssfd
  • 19
  • 2

0 Answers0