Homelab, Linux, JS & ABAP (~˘▾˘)~

[nodejs] iterate through fetch response headers


        const response = await fetch("https://example.com/api")

        for (const [key, value] of response.headers) {
            console.log(key, value)

An alternative would be forEach()

        response.headers.forEach((value, key) => {
            console.log(value, key)

Or using the entries() iterator (ES8)

          const headerIterator = response.headers.entries()

To add a new header just use set()

response.set(key, value)

[ABAP] ALV column header

DATA: o_salv TYPE REF TO cl_salv_table.

cl_salv_table=>factory( IMPORTING r_salv_table = o_salv
                        CHANGING  t_table      = l_lines ).

LOOP AT o_salv->get_columns( )->get( ) REFERENCE INTO DATA(l_column).
  DATA(lo_column) = CAST cl_salv_column( l_column->r_column ).
  lo_column->set_fixed_header_text( 'L' ).

o_salv->get_columns( )->get_column( 'TEST1' )->set_long_text( 'Test1 Header' ).
o_salv->get_columns( )->get_column( 'TEST2' )->set_long_text( 'Test2 Header' ).