Kong / Kong/httpsnippet

Support line wrap or fixed width in generated code snippet string

Abierto
#334 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
TypeScript
Estrellas
1.2k
Forks
242
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

Hi, is there any plans to support a fixed width or line break for the generated string from `HTTPSnippet.convert`?

While generating the string, in certain use cases, the output string could be quite long for some lines, and seems like there is no options to have line break or line wrap.

For example, the following code snippet would be hard to view since it takes too much horizontal width (the `url` field):
```
import axios from 'axios';

const options = {
method: 'POST',
url: 'https://url.com/this_is_a_super_long_url_this_is_a_super_long_url_this_is_a_super_long_url_this_is_a_super_long_url_'
};

try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
```

If we could possibly add a line break (boolean, or width as a number) as an option:
```
import axios from 'axios';

const options = {
method: 'POST',
url: 'https://url.com/this_is_a_super_long_url
_this_is_a_super_long_url_this_is_a_sup
er_long_url_this_is_a_super_long_url_'
};

try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
```

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Start at the HTTPSnippet.convert entry point and trace how generated code strings are assembled for the affected targets. Define how a boolean or width option should wrap long values without changing other output, then verify the generated snippet matches the requested formatting example.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
typescript
Área
tooling
Tipo de issue
Nueva funcionalidad
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.