# Http responseType blob 지원

**URL:** <https://ask.selectfromuser.com/t/http-responsetype-blob/276>\
**Category:** 공지사항\
**Tags:** http, api, blob, responsetype\
**Created:** [10월 1, 2024, 1:30오전 UTC](https://ask.selectfromuser.com/t/http-responsetype-blob/276 "2024-10-01T01:30:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hbkim](https://yyz2.discourse-cdn.com/flex032/user_avatar/ask.selectfromuser.com/hbkim/32/23_2.png) [@hbkim](https://ask.selectfromuser.com/u/hbkim)\
**Post date:** [10월 1, 2024, 1:30오전 UTC](https://ask.selectfromuser.com/t/http-responsetype-blob/276/1 "2024-10-01T01:30:32Z")

</div>

HTTP 호출 응답시 blob 지원을 통해 서버 이미지를 표시하거나, 서버 파일을 다운로드 합니다.

## 엑셀파일 다운로드시 예제

```yaml
  - type: http
    name: Block Post Download
    axios: 
      url: "{{APP_AWS_URL}}/users/export"
      method: POST
    responseType: blob
    filename: UserExport.xlsx
    params:
      - key: APP_AWS_URL
        valueFromEnv: true
      - key: purpose

```

만약 서버에서 파일이름을 내려주고 싶은 경우  
filename 옵션을 제거하고, 해당 API에서 헤더(Header) 지정이 필요합니다.

```auto
Content-Disposition: inline; filename="UserExport-20240819.xlsx"

```

YAML filename에 parameter 사용할 수도 있습니다.  
다만 서버이름이 최우선이고, 이후에 YAML filename을 이용하게 됩니다.

## 이미지 template 관련 예제

blob 응답값이 src로 내려집니다. template 기능을 통해 커스텀 가능합니다.

```yaml
    display: image
    template: |
      <a href="#" target="_blank">
        <img src="{{src}}" />
      </a>

```

## 모달 이미지 조회 예제

```yaml
    viewModal:
      useColumn: name
      blocks:
        - type: http
          name: 1
          axios: 
            url: "{{APP_AWS_URL}}/users/image"
            params:
              name: "{{name}}"
            method: POST
            methodType: GET // 바로 실행하기 위해 추가
          responseType: blob
          display: image // 추가하지않으면 다운로드됨
          style:
            maxHeight: 300px
            margin: 0 auto
          params:
            - key: APP_AWS_URL
              valueFromEnv: true
            - key: name
              valueFromRow: name

```
